Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/browser/spellchecker/spellcheck_service_browsertest.cc

Issue 2695883003: Change uses of base::JoinString to pass StringPieces where possible. (Closed)
Patch Set: Remove dependency CL. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/spellchecker/spellcheck_service.h" 5 #include "chrome/browser/spellchecker/spellcheck_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string> 9 #include <string>
10 #include <tuple> 10 #include <tuple>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "base/strings/string_piece.h"
17 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
20 #include "base/values.h" 21 #include "base/values.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/spellchecker/spellcheck_factory.h" 23 #include "chrome/browser/spellchecker/spellcheck_factory.h"
23 #include "chrome/browser/ui/browser.h" 24 #include "chrome/browser/ui/browser.h"
24 #include "chrome/common/chrome_paths.h" 25 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 base::ListValue dictionaries_value; 123 base::ListValue dictionaries_value;
123 dictionaries_value.AppendStrings( 124 dictionaries_value.AppendStrings(
124 base::SplitString(multiple_dictionaries, ",", base::TRIM_WHITESPACE, 125 base::SplitString(multiple_dictionaries, ",", base::TRIM_WHITESPACE,
125 base::SPLIT_WANT_NONEMPTY)); 126 base::SPLIT_WANT_NONEMPTY));
126 prefs_->Set(spellcheck::prefs::kSpellCheckDictionaries, dictionaries_value); 127 prefs_->Set(spellcheck::prefs::kSpellCheckDictionaries, dictionaries_value);
127 } 128 }
128 129
129 std::string GetMultilingualDictionaries() { 130 std::string GetMultilingualDictionaries() {
130 const base::ListValue* list_value = 131 const base::ListValue* list_value =
131 prefs_->GetList(spellcheck::prefs::kSpellCheckDictionaries); 132 prefs_->GetList(spellcheck::prefs::kSpellCheckDictionaries);
132 std::vector<std::string> dictionaries; 133 std::vector<base::StringPiece> dictionaries;
133 for (const auto& item_value : *list_value) { 134 for (const auto& item_value : *list_value) {
134 std::string dictionary; 135 base::StringPiece dictionary;
135 EXPECT_TRUE(item_value->GetAsString(&dictionary)); 136 EXPECT_TRUE(item_value->GetAsString(&dictionary));
136 dictionaries.push_back(dictionary); 137 dictionaries.push_back(dictionary);
137 } 138 }
138 return base::JoinString(dictionaries, ","); 139 return base::JoinString(dictionaries, ",");
139 } 140 }
140 141
141 void SetAcceptLanguages(const std::string& accept_languages) { 142 void SetAcceptLanguages(const std::string& accept_languages) {
142 ScopedPreferenceChange scope(&renderer_->sink()); 143 ScopedPreferenceChange scope(&renderer_->sink());
143 prefs_->SetString(prefs::kAcceptLanguages, accept_languages); 144 prefs_->SetString(prefs::kAcceptLanguages, accept_languages);
144 } 145 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 std::string pref; 393 std::string pref;
393 ASSERT_TRUE(GetPrefs() 394 ASSERT_TRUE(GetPrefs()
394 ->GetList(spellcheck::prefs::kSpellCheckDictionaries) 395 ->GetList(spellcheck::prefs::kSpellCheckDictionaries)
395 ->GetString(0, &pref)); 396 ->GetString(0, &pref));
396 EXPECT_EQ("en-US", pref); 397 EXPECT_EQ("en-US", pref);
397 ASSERT_TRUE(GetPrefs() 398 ASSERT_TRUE(GetPrefs()
398 ->GetList(spellcheck::prefs::kSpellCheckDictionaries) 399 ->GetList(spellcheck::prefs::kSpellCheckDictionaries)
399 ->GetString(1, &pref)); 400 ->GetString(1, &pref));
400 EXPECT_EQ("fr", pref); 401 EXPECT_EQ("fr", pref);
401 } 402 }
OLDNEW
« no previous file with comments | « chrome/browser/net/safe_search_util.cc ('k') | chrome/browser/sync_file_system/drive_backend/metadata_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698