| 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 "ash/content/keyboard_overlay/keyboard_overlay_view.h" | 5 #include "ash/content/keyboard_overlay/keyboard_overlay_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_table.h" | 9 #include "ash/accelerators/accelerator_table.h" |
| 10 #include "ash/content/keyboard_overlay/keyboard_overlay_delegate.h" | 10 #include "ash/content/keyboard_overlay/keyboard_overlay_delegate.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 // Test modifiers that might exist in a KeyEvent but they shouldn't be | 44 // Test modifiers that might exist in a KeyEvent but they shouldn't be |
| 45 // considered in an accelerator comparison to determine if a KeyEvent is a | 45 // considered in an accelerator comparison to determine if a KeyEvent is a |
| 46 // canceling key. | 46 // canceling key. |
| 47 TEST_F(KeyboardOverlayViewTest, TestCancelingKeysWithNonModifierFlags) { | 47 TEST_F(KeyboardOverlayViewTest, TestCancelingKeysWithNonModifierFlags) { |
| 48 ui::test::TestWebDialogDelegate delegate(GURL("chrome://keyboardoverlay")); | 48 ui::test::TestWebDialogDelegate delegate(GURL("chrome://keyboardoverlay")); |
| 49 KeyboardOverlayView view( | 49 KeyboardOverlayView view( |
| 50 ShellContentState::GetInstance()->GetActiveBrowserContext(), &delegate, | 50 ShellContentState::GetInstance()->GetActiveBrowserContext(), &delegate, |
| 51 new ui::test::TestWebContentsHandler); | 51 new ui::test::TestWebContentsHandler); |
| 52 | 52 |
| 53 const int kNonModifierFlags = ui::EF_IS_REPEAT | ui::EF_IME_FABRICATED_KEY | | 53 const int kNonModifierFlags = ui::EF_IS_SYNTHESIZED | ui::EF_NUM_LOCK_ON | |
| 54 ui::EF_NUM_LOCK_DOWN | ui::EF_IS_SYNTHESIZED; | 54 ui::EF_IME_FABRICATED_KEY | ui::EF_IS_REPEAT; |
| 55 | 55 |
| 56 std::vector<KeyboardOverlayView::KeyEventData> canceling_keys; | 56 std::vector<KeyboardOverlayView::KeyEventData> canceling_keys; |
| 57 KeyboardOverlayView::GetCancelingKeysForTesting(&canceling_keys); | 57 KeyboardOverlayView::GetCancelingKeysForTesting(&canceling_keys); |
| 58 for (const auto& key_data : canceling_keys) { | 58 for (const auto& key_data : canceling_keys) { |
| 59 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, key_data.key_code, | 59 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, key_data.key_code, |
| 60 key_data.flags | kNonModifierFlags); | 60 key_data.flags | kNonModifierFlags); |
| 61 EXPECT_TRUE(view.IsCancelingKeyEvent(&key_event)); | 61 EXPECT_TRUE(view.IsCancelingKeyEvent(&key_event)); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 87 | 87 |
| 88 // Other canceling keys should be same as opening keys. | 88 // Other canceling keys should be same as opening keys. |
| 89 EXPECT_EQ(open_keys.size(), canceling_keys.size()); | 89 EXPECT_EQ(open_keys.size(), canceling_keys.size()); |
| 90 for (size_t i = 0; i < canceling_keys.size(); ++i) { | 90 for (size_t i = 0; i < canceling_keys.size(); ++i) { |
| 91 EXPECT_NE(std::find(open_keys.begin(), open_keys.end(), canceling_keys[i]), | 91 EXPECT_NE(std::find(open_keys.begin(), open_keys.end(), canceling_keys[i]), |
| 92 open_keys.end()); | 92 open_keys.end()); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace ash | 96 } // namespace ash |
| OLD | NEW |