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

Side by Side Diff: ash/accelerators/accelerator_filter_unittest.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/accelerators/accelerator_delegate.cc ('k') | ash/accelerators/accelerator_table.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 "ui/wm/core/accelerator_filter.h" 5 #include "ui/wm/core/accelerator_filter.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/accelerators/accelerator_controller.h" 9 #include "ash/accelerators/accelerator_controller.h"
10 #include "ash/accelerators/accelerator_delegate.h" 10 #include "ash/accelerators/accelerator_delegate.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Normal keys are not consumed. 101 // Normal keys are not consumed.
102 ui::KeyEvent press_a(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); 102 ui::KeyEvent press_a(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
103 { 103 {
104 ui::Event::DispatcherApi dispatch_helper(&press_a); 104 ui::Event::DispatcherApi dispatch_helper(&press_a);
105 dispatch_helper.set_target(root_window); 105 dispatch_helper.set_target(root_window);
106 } 106 }
107 filter.OnKeyEvent(&press_a); 107 filter.OnKeyEvent(&press_a);
108 EXPECT_FALSE(press_a.stopped_propagation()); 108 EXPECT_FALSE(press_a.stopped_propagation());
109 109
110 // System keys are directly consumed. 110 // System keys are directly consumed.
111 ui::KeyEvent press_mute( 111 ui::KeyEvent press_mute(ui::ET_KEY_PRESSED, ui::VKEY_VOLUME_MUTE,
112 ui::ET_KEY_PRESSED, ui::VKEY_VOLUME_MUTE, ui::EF_NONE); 112 ui::EF_NONE);
113 { 113 {
114 ui::Event::DispatcherApi dispatch_helper(&press_mute); 114 ui::Event::DispatcherApi dispatch_helper(&press_mute);
115 dispatch_helper.set_target(root_window); 115 dispatch_helper.set_target(root_window);
116 } 116 }
117 filter.OnKeyEvent(&press_mute); 117 filter.OnKeyEvent(&press_mute);
118 EXPECT_TRUE(press_mute.stopped_propagation()); 118 EXPECT_TRUE(press_mute.stopped_propagation());
119 119
120 // Setting a window property on the target allows system keys to pass through. 120 // Setting a window property on the target allows system keys to pass through.
121 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(1)); 121 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(1));
122 wm::GetWindowState(window.get())->set_can_consume_system_keys(true); 122 wm::GetWindowState(window.get())->set_can_consume_system_keys(true);
123 ui::KeyEvent press_volume_up( 123 ui::KeyEvent press_volume_up(ui::ET_KEY_PRESSED, ui::VKEY_VOLUME_UP,
124 ui::ET_KEY_PRESSED, ui::VKEY_VOLUME_UP, ui::EF_NONE); 124 ui::EF_NONE);
125 ui::Event::DispatcherApi dispatch_helper(&press_volume_up); 125 ui::Event::DispatcherApi dispatch_helper(&press_volume_up);
126 dispatch_helper.set_target(window.get()); 126 dispatch_helper.set_target(window.get());
127 filter.OnKeyEvent(&press_volume_up); 127 filter.OnKeyEvent(&press_volume_up);
128 EXPECT_FALSE(press_volume_up.stopped_propagation()); 128 EXPECT_FALSE(press_volume_up.stopped_propagation());
129 129
130 // System keys pass through to a child window if the parent (top level) 130 // System keys pass through to a child window if the parent (top level)
131 // window has the property set. 131 // window has the property set.
132 std::unique_ptr<aura::Window> child(CreateTestWindowInShellWithId(2)); 132 std::unique_ptr<aura::Window> child(CreateTestWindowInShellWithId(2));
133 window->AddChild(child.get()); 133 window->AddChild(child.get());
134 dispatch_helper.set_target(child.get()); 134 dispatch_helper.set_target(child.get());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 generator.PressKey(ui::VKEY_L, ui::EF_COMMAND_DOWN); 167 generator.PressKey(ui::VKEY_L, ui::EF_COMMAND_DOWN);
168 generator.ReleaseKey(ui::VKEY_L, ui::EF_COMMAND_DOWN); 168 generator.ReleaseKey(ui::VKEY_L, ui::EF_COMMAND_DOWN);
169 EXPECT_TRUE(session_state_delegate->IsScreenLocked()); 169 EXPECT_TRUE(session_state_delegate->IsScreenLocked());
170 UnblockUserSession(); 170 UnblockUserSession();
171 EXPECT_FALSE(session_state_delegate->IsScreenLocked()); 171 EXPECT_FALSE(session_state_delegate->IsScreenLocked());
172 } 172 }
173 #endif // defined(OS_CHROMEOS) 173 #endif // defined(OS_CHROMEOS)
174 174
175 } // namespace test 175 } // namespace test
176 } // namespace ash 176 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_delegate.cc ('k') | ash/accelerators/accelerator_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698