| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/location.h" | 6 #include "base/location.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 user_input_methods.push_back("xkb:de::ger"); | 96 user_input_methods.push_back("xkb:de::ger"); |
| 97 | 97 |
| 98 chromeos::input_method::InputMethodManager::Get()->MigrateInputMethods( | 98 chromeos::input_method::InputMethodManager::Get()->MigrateInputMethods( |
| 99 &user_input_methods); | 99 &user_input_methods); |
| 100 | 100 |
| 101 LoginManagerTest::SetUpOnMainThread(); | 101 LoginManagerTest::SetUpOnMainThread(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 // Should be called from PRE_ test so that local_state is saved to disk, and | 104 // Should be called from PRE_ test so that local_state is saved to disk, and |
| 105 // reloaded in the main test. | 105 // reloaded in the main test. |
| 106 void InitUserLRUInputMethod() { | 106 void InitUserLastInputMethod() { |
| 107 PrefService* local_state = g_browser_process->local_state(); | 107 PrefService* local_state = g_browser_process->local_state(); |
| 108 | 108 |
| 109 input_method::SetUserLRUInputMethodPreferenceForTesting( | 109 input_method::SetUserLastInputMethodPreferenceForTesting( |
| 110 kTestUser1, user_input_methods[0], local_state); | 110 kTestUser1, user_input_methods[0], local_state); |
| 111 input_method::SetUserLRUInputMethodPreferenceForTesting( | 111 input_method::SetUserLastInputMethodPreferenceForTesting( |
| 112 kTestUser2, user_input_methods[1], local_state); | 112 kTestUser2, user_input_methods[1], local_state); |
| 113 } | 113 } |
| 114 | 114 |
| 115 protected: | 115 protected: |
| 116 std::vector<std::string> user_input_methods; | 116 std::vector<std::string> user_input_methods; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, PRE_CheckPODScreenDefault) { | 119 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, PRE_CheckPODScreenDefault) { |
| 120 RegisterUser(kTestUser1); | 120 RegisterUser(kTestUser1); |
| 121 RegisterUser(kTestUser2); | 121 RegisterUser(kTestUser2); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 134 EXPECT_EQ(expected_input_methods, | 134 EXPECT_EQ(expected_input_methods, |
| 135 input_method::InputMethodManager::Get() | 135 input_method::InputMethodManager::Get() |
| 136 ->GetActiveIMEState() | 136 ->GetActiveIMEState() |
| 137 ->GetActiveInputMethodIds()); | 137 ->GetActiveInputMethodIds()); |
| 138 } | 138 } |
| 139 | 139 |
| 140 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, PRE_CheckPODScreenWithUsers) { | 140 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, PRE_CheckPODScreenWithUsers) { |
| 141 RegisterUser(kTestUser1); | 141 RegisterUser(kTestUser1); |
| 142 RegisterUser(kTestUser2); | 142 RegisterUser(kTestUser2); |
| 143 | 143 |
| 144 InitUserLRUInputMethod(); | 144 InitUserLastInputMethod(); |
| 145 | 145 |
| 146 StartupUtils::MarkOobeCompleted(); | 146 StartupUtils::MarkOobeCompleted(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // TODO(crbug.com/602951): Test is flaky. | 149 // TODO(crbug.com/602951): Test is flaky. |
| 150 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, DISABLED_CheckPODScreenWithUsers) { | 150 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTest, DISABLED_CheckPODScreenWithUsers) { |
| 151 js_checker().ExpectEQ("$('pod-row').pods.length", 2); | 151 js_checker().ExpectEQ("$('pod-row').pods.length", 2); |
| 152 | 152 |
| 153 EXPECT_EQ(user_input_methods[0], | 153 EXPECT_EQ(user_input_methods[0], |
| 154 input_method::InputMethodManager::Get() | 154 input_method::InputMethodManager::Get() |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 chromeos::input_method::InputMethodManager::Get()->MigrateInputMethods( | 197 chromeos::input_method::InputMethodManager::Get()->MigrateInputMethods( |
| 198 &user_input_methods); | 198 &user_input_methods); |
| 199 | 199 |
| 200 CrosSettings::Get()->SetString(kDeviceOwner, kTestUser3); | 200 CrosSettings::Get()->SetString(kDeviceOwner, kTestUser3); |
| 201 | 201 |
| 202 LoginManagerTest::SetUpOnMainThread(); | 202 LoginManagerTest::SetUpOnMainThread(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 // Should be called from PRE_ test so that local_state is saved to disk, and | 205 // Should be called from PRE_ test so that local_state is saved to disk, and |
| 206 // reloaded in the main test. | 206 // reloaded in the main test. |
| 207 void InitUserLRUInputMethod() { | 207 void InitUserLastInputMethod() { |
| 208 PrefService* local_state = g_browser_process->local_state(); | 208 PrefService* local_state = g_browser_process->local_state(); |
| 209 | 209 |
| 210 input_method::SetUserLRUInputMethodPreferenceForTesting( | 210 input_method::SetUserLastInputMethodPreferenceForTesting( |
| 211 kTestUser1, user_input_methods[0], local_state); | 211 kTestUser1, user_input_methods[0], local_state); |
| 212 input_method::SetUserLRUInputMethodPreferenceForTesting( | 212 input_method::SetUserLastInputMethodPreferenceForTesting( |
| 213 kTestUser2, user_input_methods[1], local_state); | 213 kTestUser2, user_input_methods[1], local_state); |
| 214 input_method::SetUserLRUInputMethodPreferenceForTesting( | 214 input_method::SetUserLastInputMethodPreferenceForTesting( |
| 215 kTestUser3, user_input_methods[2], local_state); | 215 kTestUser3, user_input_methods[2], local_state); |
| 216 | 216 |
| 217 local_state->SetString(language_prefs::kPreferredKeyboardLayout, | 217 local_state->SetString(language_prefs::kPreferredKeyboardLayout, |
| 218 user_input_methods[2]); | 218 user_input_methods[2]); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void CheckGaiaKeyboard(); | 221 void CheckGaiaKeyboard(); |
| 222 | 222 |
| 223 protected: | 223 protected: |
| 224 std::vector<std::string> user_input_methods; | 224 std::vector<std::string> user_input_methods; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 236 ->GetActiveIMEState() | 236 ->GetActiveIMEState() |
| 237 ->GetActiveInputMethodIds()); | 237 ->GetActiveInputMethodIds()); |
| 238 } | 238 } |
| 239 | 239 |
| 240 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTestWithUsersAndOwner, | 240 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTestWithUsersAndOwner, |
| 241 PRE_CheckPODScreenKeyboard) { | 241 PRE_CheckPODScreenKeyboard) { |
| 242 RegisterUser(kTestUser1); | 242 RegisterUser(kTestUser1); |
| 243 RegisterUser(kTestUser2); | 243 RegisterUser(kTestUser2); |
| 244 RegisterUser(kTestUser3); | 244 RegisterUser(kTestUser3); |
| 245 | 245 |
| 246 InitUserLRUInputMethod(); | 246 InitUserLastInputMethod(); |
| 247 | 247 |
| 248 StartupUtils::MarkOobeCompleted(); | 248 StartupUtils::MarkOobeCompleted(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTestWithUsersAndOwner, | 251 IN_PROC_BROWSER_TEST_F(LoginUIKeyboardTestWithUsersAndOwner, |
| 252 CheckPODScreenKeyboard) { | 252 CheckPODScreenKeyboard) { |
| 253 js_checker().ExpectEQ("$('pod-row').pods.length", 3); | 253 js_checker().ExpectEQ("$('pod-row').pods.length", 3); |
| 254 | 254 |
| 255 std::vector<std::string> expected_input_methods; | 255 std::vector<std::string> expected_input_methods; |
| 256 // Owner input method. | 256 // Owner input method. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 273 // Switch back. | 273 // Switch back. |
| 274 js_checker().Evaluate("$('gaia-signin').cancel()"); | 274 js_checker().Evaluate("$('gaia-signin').cancel()"); |
| 275 OobeScreenWaiter(OobeScreen::SCREEN_ACCOUNT_PICKER).Wait(); | 275 OobeScreenWaiter(OobeScreen::SCREEN_ACCOUNT_PICKER).Wait(); |
| 276 | 276 |
| 277 EXPECT_EQ(expected_input_methods, | 277 EXPECT_EQ(expected_input_methods, |
| 278 input_method::InputMethodManager::Get() | 278 input_method::InputMethodManager::Get() |
| 279 ->GetActiveIMEState() | 279 ->GetActiveIMEState() |
| 280 ->GetActiveInputMethodIds()); | 280 ->GetActiveInputMethodIds()); |
| 281 } | 281 } |
| 282 } // namespace chromeos | 282 } // namespace chromeos |
| OLD | NEW |