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

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

Issue 14316012: Apply the namespace migration for "savefile.default_directory" user-pref as well. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/prefs/pref_member.h" 7 #include "base/prefs/pref_member.h"
8 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" 8 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
9 #include "chrome/browser/download/chrome_download_manager_delegate.h"
9 #include "chrome/browser/download/download_prefs.h" 10 #include "chrome/browser/download/download_prefs.h"
10 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
11 #include "chrome/test/base/testing_pref_service_syncable.h" 12 #include "chrome/test/base/testing_pref_service_syncable.h"
12 #include "components/user_prefs/pref_registry_syncable.h" 13 #include "components/user_prefs/pref_registry_syncable.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace chromeos { 16 namespace chromeos {
16 namespace { 17 namespace {
17 18
18 class MyMockInputMethodManager : public input_method::MockInputMethodManager { 19 class MyMockInputMethodManager : public input_method::MockInputMethodManager {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 StringPrefMember* previous_; 52 StringPrefMember* previous_;
52 StringPrefMember* current_; 53 StringPrefMember* current_;
53 }; 54 };
54 55
55 } // anonymous namespace 56 } // anonymous namespace
56 57
57 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { 58 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) {
58 TestingPrefServiceSyncable prefs; 59 TestingPrefServiceSyncable prefs;
59 Preferences::RegisterUserPrefs(prefs.registry()); 60 Preferences::RegisterUserPrefs(prefs.registry());
60 DownloadPrefs::RegisterUserPrefs(prefs.registry()); 61 DownloadPrefs::RegisterUserPrefs(prefs.registry());
62 ChromeDownloadManagerDelegate::RegisterUserPrefs(prefs.registry());
61 // kSelectFileLastDirectory is registered for Profile. Here we register it for 63 // kSelectFileLastDirectory is registered for Profile. Here we register it for
62 // testing. 64 // testing.
63 prefs.registry()->RegisterStringPref(prefs::kSelectFileLastDirectory, 65 prefs.registry()->RegisterStringPref(prefs::kSelectFileLastDirectory,
64 std::string(), 66 std::string(),
65 PrefRegistrySyncable::UNSYNCABLE_PREF); 67 PrefRegistrySyncable::UNSYNCABLE_PREF);
66 68
67 StringPrefMember previous; 69 StringPrefMember previous;
68 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs); 70 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs);
69 previous.SetValue("KeyboardA"); 71 previous.SetValue("KeyboardA");
70 StringPrefMember current; 72 StringPrefMember current;
71 current.Init(prefs::kLanguageCurrentInputMethod, &prefs); 73 current.Init(prefs::kLanguageCurrentInputMethod, &prefs);
72 current.SetValue("KeyboardB"); 74 current.SetValue("KeyboardB");
73 75
74 MyMockInputMethodManager mock_manager(&previous, &current); 76 MyMockInputMethodManager mock_manager(&previous, &current);
75 Preferences testee(&mock_manager); 77 Preferences testee(&mock_manager);
76 testee.InitUserPrefsForTesting(&prefs); 78 testee.InitUserPrefsForTesting(&prefs);
77 testee.SetInputMethodListForTesting(); 79 testee.SetInputMethodListForTesting();
78 80
79 // Confirm they're unchanged. 81 // Confirm they're unchanged.
80 EXPECT_EQ("KeyboardA", previous.GetValue()); 82 EXPECT_EQ("KeyboardA", previous.GetValue());
81 EXPECT_EQ("KeyboardB", current.GetValue()); 83 EXPECT_EQ("KeyboardB", current.GetValue());
82 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_); 84 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_);
83 } 85 }
84 86
85 } // namespace chromeos 87 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698