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_manager_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 18 matching lines...) Expand all Loading... | |
29 #include "ui/base/ime/chromeos/extension_ime_util.h" | 29 #include "ui/base/ime/chromeos/extension_ime_util.h" |
30 #include "ui/base/ime/chromeos/fake_ime_keyboard.h" | 30 #include "ui/base/ime/chromeos/fake_ime_keyboard.h" |
31 #include "ui/base/ime/chromeos/fake_input_method_delegate.h" | 31 #include "ui/base/ime/chromeos/fake_input_method_delegate.h" |
32 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" | 32 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" |
33 #include "ui/base/ime/chromeos/mock_ime_engine_handler.h" | 33 #include "ui/base/ime/chromeos/mock_ime_engine_handler.h" |
34 #include "ui/base/ime/ime_bridge.h" | 34 #include "ui/base/ime/ime_bridge.h" |
35 #include "ui/base/ime/input_method_initializer.h" | 35 #include "ui/base/ime/input_method_initializer.h" |
36 #include "ui/chromeos/ime/input_method_menu_item.h" | 36 #include "ui/chromeos/ime/input_method_menu_item.h" |
37 #include "ui/chromeos/ime/input_method_menu_manager.h" | 37 #include "ui/chromeos/ime/input_method_menu_manager.h" |
38 #include "ui/events/keycodes/keyboard_codes.h" | 38 #include "ui/events/keycodes/keyboard_codes.h" |
39 #include "ui/keyboard/content/keyboard_content_util.h" | |
39 | 40 |
40 namespace chromeos { | 41 namespace chromeos { |
41 | 42 |
42 namespace input_method { | 43 namespace input_method { |
43 namespace { | 44 namespace { |
44 | 45 |
45 const char kNaclMozcUsId[] = "nacl_mozc_us"; | 46 const char kNaclMozcUsId[] = "nacl_mozc_us"; |
46 const char kNaclMozcJpId[] = "nacl_mozc_jp"; | 47 const char kNaclMozcJpId[] = "nacl_mozc_jp"; |
47 const char kExt2Engine1Id[] = "ext2_engine1-t-i0-engine_id"; | 48 const char kExt2Engine1Id[] = "ext2_engine1-t-i0-engine_id"; |
48 const char kExt2Engine2Id[] = "ext2_engine2-t-i0-engine_id"; | 49 const char kExt2Engine2Id[] = "ext2_engine2-t-i0-engine_id"; |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1402 manager_->MigrateInputMethods(&input_method_ids); | 1403 manager_->MigrateInputMethods(&input_method_ids); |
1403 | 1404 |
1404 ASSERT_EQ(4U, input_method_ids.size()); | 1405 ASSERT_EQ(4U, input_method_ids.size()); |
1405 | 1406 |
1406 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), input_method_ids[0]); | 1407 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), input_method_ids[0]); |
1407 EXPECT_EQ(ImeIdFromEngineId("xkb:fr::fra"), input_method_ids[1]); | 1408 EXPECT_EQ(ImeIdFromEngineId("xkb:fr::fra"), input_method_ids[1]); |
1408 EXPECT_EQ("_comp_ime_asdf_pinyin", input_method_ids[2]); | 1409 EXPECT_EQ("_comp_ime_asdf_pinyin", input_method_ids[2]); |
1409 EXPECT_EQ(ImeIdFromEngineId("zh-t-i0-pinyin"), input_method_ids[3]); | 1410 EXPECT_EQ(ImeIdFromEngineId("zh-t-i0-pinyin"), input_method_ids[3]); |
1410 } | 1411 } |
1411 | 1412 |
1413 TEST_F(InputMethodManagerImplTest, OverrideKeyboardRefWithEmoji) { | |
1414 GURL inputview_url( | |
1415 "chrome-extension://" | |
1416 "inputview.html#id=us.compact.qwerty&language=en-US&passwordLayout=us." | |
1417 "compact.qwerty&name=keyboard_us"); | |
1418 keyboard::SetOverrideContentUrl(inputview_url); | |
1419 | |
1420 EXPECT_EQ(inputview_url, keyboard::GetOverrideContentUrl()); | |
1421 | |
1422 manager_->OverrideKeyboardRef("emoji"); | |
1423 GURL overridden_url( | |
1424 "chrome-extension://" | |
1425 "inputview.html#id=emoji&language=en-US&passwordLayout=us." | |
1426 "compact.qwerty&name=keyboard_us"); | |
1427 EXPECT_EQ(overridden_url, keyboard::GetOverrideContentUrl()); | |
1428 } | |
1429 | |
1430 TEST_F(InputMethodManagerImplTest, OverrideDefaultKeyboardRef) { | |
1431 GURL default_url_("chrome://inputview.html"); | |
James Cook
2016/09/14 21:14:28
nit: no trailing _ for local variable
Azure Wei
2016/09/15 03:44:51
Done.
| |
1432 keyboard::SetOverrideContentUrl(default_url_); | |
1433 | |
1434 EXPECT_EQ(default_url_, keyboard::GetOverrideContentUrl()); | |
James Cook
2016/09/14 21:14:28
optional: it's OK to copy/paste strings in tests i
| |
1435 | |
1436 manager_->OverrideKeyboardRef("emoji"); | |
1437 EXPECT_EQ(default_url_, keyboard::GetOverrideContentUrl()); | |
1438 } | |
1439 | |
1412 } // namespace input_method | 1440 } // namespace input_method |
1413 } // namespace chromeos | 1441 } // namespace chromeos |
OLD | NEW |