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

Side by Side Diff: chrome/browser/chromeos/preferences_unittest.cc

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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/chromeos/preferences.h" 5 #include "chrome/browser/chromeos/preferences.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/prefs/pref_member.h" 8 #include "base/prefs/pref_member.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 void ExpectGlobalValues(const std::string& preferred_languages, 332 void ExpectGlobalValues(const std::string& preferred_languages,
333 const std::string& preload_engines, 333 const std::string& preload_engines,
334 const std::string& enabled_extension_imes) { 334 const std::string& enabled_extension_imes) {
335 EXPECT_EQ(preferred_languages, preferred_languages_syncable_.GetValue()); 335 EXPECT_EQ(preferred_languages, preferred_languages_syncable_.GetValue());
336 EXPECT_EQ(preload_engines, preload_engines_syncable_.GetValue()); 336 EXPECT_EQ(preload_engines, preload_engines_syncable_.GetValue());
337 EXPECT_EQ(enabled_extension_imes, 337 EXPECT_EQ(enabled_extension_imes,
338 enabled_extension_imes_syncable_.GetValue()); 338 enabled_extension_imes_syncable_.GetValue());
339 } 339 }
340 340
341 // Translates engine IDs in a CSV string to input method IDs. 341 // Translates engine IDs in a CSV string to input method IDs.
342 std::string ToInputMethodIds(std::string value) { 342 std::string ToInputMethodIds(const std::string& value) {
343 std::vector<std::string> tokens = base::SplitString( 343 std::vector<std::string> tokens = base::SplitString(
344 value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 344 value, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
345 std::transform(tokens.begin(), tokens.end(), tokens.begin(), 345 std::transform(tokens.begin(), tokens.end(), tokens.begin(),
346 &extension_ime_util::GetInputMethodIDByEngineID); 346 &extension_ime_util::GetInputMethodIDByEngineID);
347 return base::JoinString(tokens, ","); 347 return base::JoinString(tokens, ",");
348 } 348 }
349 349
350 StringPrefMember preferred_languages_; 350 StringPrefMember preferred_languages_;
351 StringPrefMember preferred_languages_syncable_; 351 StringPrefMember preferred_languages_syncable_;
352 StringPrefMember preload_engines_; 352 StringPrefMember preload_engines_;
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 "Syncable values should have added local values on initialization."); 698 "Syncable values should have added local values on initialization.");
699 ExpectGlobalValues( 699 ExpectGlobalValues(
700 "es,en-US", 700 "es,en-US",
701 "xkb:es::spa,xkb:us::eng,xkb:ru::rus,xkb:xy::xyz," + 701 "xkb:es::spa,xkb:us::eng,xkb:ru::rus,xkb:xy::xyz," +
702 ToInputMethodIds("xkb:jp::jpn"), 702 ToInputMethodIds("xkb:jp::jpn"),
703 std::string(kIdentityIMEID) + "," + kUnknownIMEID); 703 std::string(kIdentityIMEID) + "," + kUnknownIMEID);
704 } 704 }
705 } 705 }
706 706
707 } // namespace chromeos 707 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698