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/input_method/input_method_persistence.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_persistence.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.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/language_preferences.h" | 9 #include "chrome/browser/chromeos/language_preferences.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace { | 24 namespace { |
25 const char kInputId1[] = "xkb:us:dvorak:eng"; | 25 const char kInputId1[] = "xkb:us:dvorak:eng"; |
26 const char kInputId2[] = "xkb:us:colemak:eng"; | 26 const char kInputId2[] = "xkb:us:colemak:eng"; |
27 const char kProfileName[] = "input_method_test"; | 27 const char kProfileName[] = "input_method_test"; |
28 } | 28 } |
29 | 29 |
30 class InputMethodPersistenceTest : public testing::Test { | 30 class InputMethodPersistenceTest : public testing::Test { |
31 protected: | 31 protected: |
32 InputMethodPersistenceTest() | 32 InputMethodPersistenceTest() |
33 : mock_profile_manager_( | 33 : mock_profile_manager_(TestingBrowserProcess::GetGlobal()) {} |
34 static_cast<TestingBrowserProcess*>(g_browser_process)) { | |
35 } | |
36 | 34 |
37 virtual void SetUp() OVERRIDE { | 35 virtual void SetUp() OVERRIDE { |
38 // Set up a profile that will be returned by | 36 // Set up a profile that will be returned by |
39 // ProfileManager::GetDefaultProfile(). | 37 // ProfileManager::GetDefaultProfile(). |
40 ASSERT_TRUE(mock_profile_manager_.SetUp()); | 38 ASSERT_TRUE(mock_profile_manager_.SetUp()); |
41 TestingProfile* mock_profile = | 39 TestingProfile* mock_profile = |
42 mock_profile_manager_.CreateTestingProfile(kProfileName); | 40 mock_profile_manager_.CreateTestingProfile(kProfileName); |
43 CommandLine *cl = CommandLine::ForCurrentProcess(); | 41 CommandLine *cl = CommandLine::ForCurrentProcess(); |
44 cl->AppendSwitchASCII(switches::kLoginProfile, kProfileName); | 42 cl->AppendSwitchASCII(switches::kLoginProfile, kProfileName); |
45 mock_profile_manager_.SetLoggedIn(true); | 43 mock_profile_manager_.SetLoggedIn(true); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 VerifyPrefs(kInputId2, "", kInputId2); | 100 VerifyPrefs(kInputId2, "", kInputId2); |
103 | 101 |
104 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN); | 102 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN); |
105 mock_manager_.SetCurrentInputMethodId(kInputId1); | 103 mock_manager_.SetCurrentInputMethodId(kInputId1); |
106 persistence.InputMethodChanged(&mock_manager_, false); | 104 persistence.InputMethodChanged(&mock_manager_, false); |
107 VerifyPrefs(kInputId1, kInputId2, kInputId2); | 105 VerifyPrefs(kInputId1, kInputId2, kInputId2); |
108 } | 106 } |
109 | 107 |
110 } // namespace input_method | 108 } // namespace input_method |
111 } // namespace chromeos | 109 } // namespace chromeos |
OLD | NEW |