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

Side by Side Diff: services/ui/public/cpp/tests/window_tree_client_unittest.cc

Issue 2180683003: NOSUBMIT: PointerWatcher observes all pointer events, with moves optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/public/cpp/window_tree_client.h" 5 #include "services/ui/public/cpp/window_tree_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 event_handler.set_should_manually_ack(); 459 event_handler.set_should_manually_ack();
460 setup.window_tree_client()->OnWindowInputEvent( 460 setup.window_tree_client()->OnWindowInputEvent(
461 33, server_id(root), ui::Event::Clone(*ui_event.get()), 0); 461 33, server_id(root), ui::Event::Clone(*ui_event.get()), 0);
462 EXPECT_TRUE(event_handler.received_event()); 462 EXPECT_TRUE(event_handler.received_event());
463 EXPECT_FALSE(setup.window_tree()->WasEventAcked(33)); 463 EXPECT_FALSE(setup.window_tree()->WasEventAcked(33));
464 464
465 event_handler.AckEvent(); 465 event_handler.AckEvent();
466 EXPECT_TRUE(setup.window_tree()->WasEventAcked(33)); 466 EXPECT_TRUE(setup.window_tree()->WasEventAcked(33));
467 } 467 }
468 468
469 // JAMES - rewrite for StartPointerWatcher. It should be simpler since we won't
470 // have to construct all the EventMatchers.
471 #if 0
472
469 // Tests event observers triggered by events that did not hit a target in this 473 // Tests event observers triggered by events that did not hit a target in this
470 // window tree. 474 // window tree.
471 TEST_F(WindowTreeClientTest, OnEventObserved) { 475 TEST_F(WindowTreeClientTest, OnEventObserved) {
472 WindowTreeSetup setup; 476 WindowTreeSetup setup;
473 Window* root = setup.GetFirstRoot(); 477 Window* root = setup.GetFirstRoot();
474 ASSERT_TRUE(root); 478 ASSERT_TRUE(root);
475 479
476 // Set up an event observer. 480 // Set up an event observer.
477 mojom::EventMatcherPtr matcher = mojom::EventMatcher::New(); 481 mojom::EventMatcherPtr matcher = mojom::EventMatcher::New();
478 matcher->type_matcher = mojom::EventTypeMatcher::New(); 482 matcher->type_matcher = mojom::EventTypeMatcher::New();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 ui::EventTimeForNow(), ui::EF_CONTROL_DOWN, 0)); 572 ui::EventTimeForNow(), ui::EF_CONTROL_DOWN, 0));
569 setup.window_tree_client()->OnEventObserved(std::move(released_event), 573 setup.window_tree_client()->OnEventObserved(std::move(released_event),
570 event_observer_id2); 574 event_observer_id2);
571 575
572 // The delegate sensed the event. 576 // The delegate sensed the event.
573 ui::Event* last_event = setup.window_tree_delegate()->last_event_observed(); 577 ui::Event* last_event = setup.window_tree_delegate()->last_event_observed();
574 EXPECT_EQ(ui::ET_MOUSE_RELEASED, last_event->type()); 578 EXPECT_EQ(ui::ET_MOUSE_RELEASED, last_event->type());
575 EXPECT_EQ(ui::EF_CONTROL_DOWN, last_event->flags()); 579 EXPECT_EQ(ui::EF_CONTROL_DOWN, last_event->flags());
576 } 580 }
577 581
582 #endif
583 // JAMES
584
578 // Verifies focus is reverted if the server replied that the change failed. 585 // Verifies focus is reverted if the server replied that the change failed.
579 TEST_F(WindowTreeClientTest, SetFocusFailed) { 586 TEST_F(WindowTreeClientTest, SetFocusFailed) {
580 WindowTreeSetup setup; 587 WindowTreeSetup setup;
581 Window* root = setup.GetFirstRoot(); 588 Window* root = setup.GetFirstRoot();
582 ASSERT_TRUE(root); 589 ASSERT_TRUE(root);
583 root->SetVisible(true); 590 root->SetVisible(true);
584 Window* child = setup.client()->NewWindow(); 591 Window* child = setup.client()->NewWindow();
585 child->SetVisible(true); 592 child->SetVisible(true);
586 root->AddChild(child); 593 root->AddChild(child);
587 Window* original_focus = setup.client()->GetFocusedWindow(); 594 Window* original_focus = setup.client()->GetFocusedWindow();
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 1049
1043 // Create a new Window, and attempt to place capture on that. 1050 // Create a new Window, and attempt to place capture on that.
1044 Window* child = setup.client()->NewWindow(); 1051 Window* child = setup.client()->NewWindow();
1045 child->SetVisible(true); 1052 child->SetVisible(true);
1046 root->AddChild(child); 1053 root->AddChild(child);
1047 child->SetCapture(); 1054 child->SetCapture();
1048 EXPECT_TRUE(child->HasCapture()); 1055 EXPECT_TRUE(child->HasCapture());
1049 } 1056 }
1050 1057
1051 } // namespace ui 1058 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/tests/window_tree_client_private.cc ('k') | services/ui/public/cpp/window_tree_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698