OLD | NEW |
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/chromeos/login/users/fake_user_manager.h" | 9 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
10 #include "chrome/browser/chromeos/login/users/user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/user_manager.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 StringPrefMember* previous_; | 43 StringPrefMember* previous_; |
44 StringPrefMember* current_; | 44 StringPrefMember* current_; |
45 }; | 45 }; |
46 | 46 |
47 } // anonymous namespace | 47 } // anonymous namespace |
48 | 48 |
49 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { | 49 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { |
50 chromeos::FakeUserManager* user_manager = new chromeos::FakeUserManager(); | 50 chromeos::FakeUserManager* user_manager = new chromeos::FakeUserManager(); |
51 chromeos::ScopedUserManagerEnabler user_manager_enabler(user_manager); | 51 chromeos::ScopedUserManagerEnabler user_manager_enabler(user_manager); |
52 const char test_user_email[] = "test_user@example.com"; | 52 const char test_user_email[] = "test_user@example.com"; |
53 const User* test_user = user_manager->AddUser(test_user_email); | 53 const user_manager::User* test_user = user_manager->AddUser(test_user_email); |
54 user_manager->LoginUser(test_user_email); | 54 user_manager->LoginUser(test_user_email); |
55 | 55 |
56 TestingPrefServiceSyncable prefs; | 56 TestingPrefServiceSyncable prefs; |
57 Preferences::RegisterProfilePrefs(prefs.registry()); | 57 Preferences::RegisterProfilePrefs(prefs.registry()); |
58 DownloadPrefs::RegisterProfilePrefs(prefs.registry()); | 58 DownloadPrefs::RegisterProfilePrefs(prefs.registry()); |
59 // kSelectFileLastDirectory is registered for Profile. Here we register it for | 59 // kSelectFileLastDirectory is registered for Profile. Here we register it for |
60 // testing. | 60 // testing. |
61 prefs.registry()->RegisterStringPref( | 61 prefs.registry()->RegisterStringPref( |
62 prefs::kSelectFileLastDirectory, | 62 prefs::kSelectFileLastDirectory, |
63 std::string(), | 63 std::string(), |
(...skipping 11 matching lines...) Expand all Loading... |
75 testee.InitUserPrefsForTesting(&prefs, test_user); | 75 testee.InitUserPrefsForTesting(&prefs, test_user); |
76 testee.SetInputMethodListForTesting(); | 76 testee.SetInputMethodListForTesting(); |
77 | 77 |
78 // Confirm they're unchanged. | 78 // Confirm they're unchanged. |
79 EXPECT_EQ("KeyboardA", previous.GetValue()); | 79 EXPECT_EQ("KeyboardA", previous.GetValue()); |
80 EXPECT_EQ("KeyboardB", current.GetValue()); | 80 EXPECT_EQ("KeyboardB", current.GetValue()); |
81 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_); | 81 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_); |
82 } | 82 } |
83 | 83 |
84 } // namespace chromeos | 84 } // namespace chromeos |
OLD | NEW |