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

Side by Side Diff: services/ui/ws/window_manager_state_unittest.cc

Issue 2520093003: WindowManagerClient::AddAccelerator() should take an array (Closed)
Patch Set: Forget to add these files to previous patch. Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/ui/ws/window_manager_state.h" 5 #include "services/ui/ws/window_manager_state.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 child_window->SetVisible(true); 225 child_window->SetVisible(true);
226 SetCanFocusUp(child_window); 226 SetCanFocusUp(child_window);
227 tree()->GetDisplay(child_window)->AddActivationParent(child_window->parent()); 227 tree()->GetDisplay(child_window)->AddActivationParent(child_window->parent());
228 ASSERT_TRUE(window_tree()->SetFocus(child_window_id)); 228 ASSERT_TRUE(window_tree()->SetFocus(child_window_id));
229 229
230 // Register a pre-accelerator. 230 // Register a pre-accelerator.
231 uint32_t accelerator_id = 11; 231 uint32_t accelerator_id = 11;
232 { 232 {
233 mojom::EventMatcherPtr matcher = ui::CreateKeyMatcher( 233 mojom::EventMatcherPtr matcher = ui::CreateKeyMatcher(
234 ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagControlDown); 234 ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagControlDown);
235
236 ui::mojom::AcceleratorEventPtr accelerator_event(
237 ui::mojom::AcceleratorEvent::New());
238 accelerator_event->id = accelerator_id;
239 accelerator_event->event_matcher = std::move(matcher);
240
241 mojo::Array<ui::mojom::AcceleratorEventPtr> multi_accelerators;
242 multi_accelerators.push_back(std::move(accelerator_event));
235 ASSERT_TRUE(window_manager_state()->event_dispatcher()->AddAccelerator( 243 ASSERT_TRUE(window_manager_state()->event_dispatcher()->AddAccelerator(
236 accelerator_id, std::move(matcher))); 244 std::move(multi_accelerators)));
237 } 245 }
238 TestChangeTracker* tracker = wm_client()->tracker(); 246 TestChangeTracker* tracker = wm_client()->tracker();
239 tracker->changes()->clear(); 247 tracker->changes()->clear();
240 TestChangeTracker* tracker2 = window_tree_client()->tracker(); 248 TestChangeTracker* tracker2 = window_tree_client()->tracker();
241 tracker2->changes()->clear(); 249 tracker2->changes()->clear();
242 250
243 // Send an ensure only the pre accelerator is called. 251 // Send an ensure only the pre accelerator is called.
244 ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); 252 ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
245 window_manager_state()->ProcessEvent(key); 253 window_manager_state()->ProcessEvent(key);
246 EXPECT_TRUE(window_manager()->on_accelerator_called()); 254 EXPECT_TRUE(window_manager()->on_accelerator_called());
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 ASSERT_EQ(1u, tree->roots().size()); 569 ASSERT_EQ(1u, tree->roots().size());
562 ClientWindowId root_client_id; 570 ClientWindowId root_client_id;
563 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id)); 571 ASSERT_TRUE(tree->IsWindowKnown(*(tree->roots().begin()), &root_client_id));
564 EXPECT_TRUE(tree->DeleteWindow(root_client_id)); 572 EXPECT_TRUE(tree->DeleteWindow(root_client_id));
565 window_server->DestroyTree(tree); 573 window_server->DestroyTree(tree);
566 } 574 }
567 575
568 } // namespace test 576 } // namespace test
569 } // namespace ws 577 } // namespace ws
570 } // namespace ui 578 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698