Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(756)

Side by Side Diff: ash/content/keyboard_overlay/keyboard_overlay_view_unittest.cc

Issue 1559163002: Clean up event flags a bit: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/autoclick/autoclick_controller.cc ('k') | chrome/browser/chromeos/events/event_rewriter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ash/autoclick/autoclick_controller.cc ('k') | chrome/browser/chromeos/events/event_rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698