Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/virtual_keyboard_selector.h" | 5 #include "chrome/browser/chromeos/input_method/virtual_keyboard_selector.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 // For EXPECT_TRUE calls below. The operator has to be in the global namespace. | 10 // For EXPECT_TRUE calls below. The operator has to be in the global namespace. |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 selector.AddVirtualKeyboard(user_virtual_keyboard_2.url(), | 364 selector.AddVirtualKeyboard(user_virtual_keyboard_2.url(), |
| 365 user_virtual_keyboard_2.supported_layouts(), | 365 user_virtual_keyboard_2.supported_layouts(), |
| 366 user_virtual_keyboard_2.is_system()); | 366 user_virtual_keyboard_2.is_system()); |
| 367 selector.AddVirtualKeyboard(system_virtual_keyboard_1.url(), | 367 selector.AddVirtualKeyboard(system_virtual_keyboard_1.url(), |
| 368 system_virtual_keyboard_1.supported_layouts(), | 368 system_virtual_keyboard_1.supported_layouts(), |
| 369 system_virtual_keyboard_1.is_system()); | 369 system_virtual_keyboard_1.is_system()); |
| 370 selector.AddVirtualKeyboard(system_virtual_keyboard_2.url(), | 370 selector.AddVirtualKeyboard(system_virtual_keyboard_2.url(), |
| 371 system_virtual_keyboard_2.supported_layouts(), | 371 system_virtual_keyboard_2.supported_layouts(), |
| 372 system_virtual_keyboard_2.is_system()); | 372 system_virtual_keyboard_2.is_system()); |
| 373 | 373 |
| 374 // Set and then remove user pref (=NOP). | 374 // Set and then remove user prefs (=NOP). |
| 375 EXPECT_TRUE(selector.SetUserPreference("a", GURL("http://system1"))); | 375 EXPECT_TRUE(selector.SetUserPreference("a", GURL("http://system1"))); |
| 376 selector.RemoveUserPreference("a"); | 376 EXPECT_TRUE(selector.SetUserPreference("z", GURL("http://system2"))); |
| 377 selector.ClearUserPreference(); | |
|
bryeung
2011/08/03 22:15:40
There should still be a test for RemoveUserPrefere
Yusuke Sato
2011/08/04 07:34:50
Done.
| |
| 377 | 378 |
| 378 // At this point, user_virtual_keyboard_2 has the highest priority. | 379 // At this point, user_virtual_keyboard_2 has the highest priority. |
| 379 ASSERT_TRUE(selector.SelectVirtualKeyboardWithoutPreferences("a")); | 380 ASSERT_TRUE(selector.SelectVirtualKeyboardWithoutPreferences("a")); |
| 380 EXPECT_TRUE(user_virtual_keyboard_2 == | 381 EXPECT_TRUE(user_virtual_keyboard_2 == |
| 381 *selector.SelectVirtualKeyboard("a")); | 382 *selector.SelectVirtualKeyboard("a")); |
| 382 ASSERT_TRUE(selector.SelectVirtualKeyboardWithoutPreferences("c")); | 383 ASSERT_TRUE(selector.SelectVirtualKeyboardWithoutPreferences("c")); |
| 383 EXPECT_TRUE(user_virtual_keyboard_2 == | 384 EXPECT_TRUE(user_virtual_keyboard_2 == |
| 384 *selector.SelectVirtualKeyboard("c")); | 385 *selector.SelectVirtualKeyboard("c")); |
| 385 ASSERT_TRUE(selector.SelectVirtualKeyboardWithoutPreferences("d")); | 386 ASSERT_TRUE(selector.SelectVirtualKeyboardWithoutPreferences("d")); |
| 386 EXPECT_TRUE(user_virtual_keyboard_2 == | 387 EXPECT_TRUE(user_virtual_keyboard_2 == |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 *selector.SelectVirtualKeyboard("a")); | 441 *selector.SelectVirtualKeyboard("a")); |
| 441 | 442 |
| 442 // Switch back to user_virtual_keyboard_1. | 443 // Switch back to user_virtual_keyboard_1. |
| 443 ASSERT_TRUE(selector.SelectVirtualKeyboardWithoutPreferences("c")); | 444 ASSERT_TRUE(selector.SelectVirtualKeyboardWithoutPreferences("c")); |
| 444 EXPECT_TRUE(user_virtual_keyboard_2 == | 445 EXPECT_TRUE(user_virtual_keyboard_2 == |
| 445 *selector.SelectVirtualKeyboard("c")); | 446 *selector.SelectVirtualKeyboard("c")); |
| 446 } | 447 } |
| 447 | 448 |
| 448 } // namespace input_method | 449 } // namespace input_method |
| 449 } // namespace chromeos | 450 } // namespace chromeos |
| OLD | NEW |