| OLD | NEW |
| 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 "components/mus/public/cpp/lib/window_tree_client_impl.h" | 5 #include "components/mus/public/cpp/lib/window_tree_client_impl.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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 Window* root = setup.GetFirstRoot(); | 458 Window* root = setup.GetFirstRoot(); |
| 459 ASSERT_TRUE(root); | 459 ASSERT_TRUE(root); |
| 460 | 460 |
| 461 TestInputEventHandler event_handler; | 461 TestInputEventHandler event_handler; |
| 462 root->set_input_event_handler(&event_handler); | 462 root->set_input_event_handler(&event_handler); |
| 463 | 463 |
| 464 std::unique_ptr<ui::Event> ui_event( | 464 std::unique_ptr<ui::Event> ui_event( |
| 465 new ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), | 465 new ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(), |
| 466 ui::EventTimeForNow(), ui::EF_NONE, 0)); | 466 ui::EventTimeForNow(), ui::EF_NONE, 0)); |
| 467 setup.window_tree_client()->OnWindowInputEvent( | 467 setup.window_tree_client()->OnWindowInputEvent( |
| 468 1, server_id(root), mojom::Event::From(*ui_event.get())); | 468 1, server_id(root), mojom::Event::From(*ui_event.get()), false); |
| 469 EXPECT_TRUE(event_handler.received_event()); | 469 EXPECT_TRUE(event_handler.received_event()); |
| 470 EXPECT_TRUE(setup.window_tree()->WasEventAcked(1)); | 470 EXPECT_TRUE(setup.window_tree()->WasEventAcked(1)); |
| 471 event_handler.Reset(); | 471 event_handler.Reset(); |
| 472 | 472 |
| 473 event_handler.set_should_manually_ack(); | 473 event_handler.set_should_manually_ack(); |
| 474 setup.window_tree_client()->OnWindowInputEvent( | 474 setup.window_tree_client()->OnWindowInputEvent( |
| 475 33, server_id(root), mojom::Event::From(*ui_event.get())); | 475 33, server_id(root), mojom::Event::From(*ui_event.get()), false); |
| 476 EXPECT_TRUE(event_handler.received_event()); | 476 EXPECT_TRUE(event_handler.received_event()); |
| 477 EXPECT_FALSE(setup.window_tree()->WasEventAcked(33)); | 477 EXPECT_FALSE(setup.window_tree()->WasEventAcked(33)); |
| 478 | 478 |
| 479 event_handler.AckEvent(); | 479 event_handler.AckEvent(); |
| 480 EXPECT_TRUE(setup.window_tree()->WasEventAcked(33)); | 480 EXPECT_TRUE(setup.window_tree()->WasEventAcked(33)); |
| 481 } | 481 } |
| 482 | 482 |
| 483 // Verifies focus is reverted if the server replied that the change failed. | 483 // Verifies focus is reverted if the server replied that the change failed. |
| 484 TEST_F(WindowTreeClientImplTest, SetFocusFailed) { | 484 TEST_F(WindowTreeClientImplTest, SetFocusFailed) { |
| 485 WindowTreeSetup setup; | 485 WindowTreeSetup setup; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 | 921 |
| 922 setup.window_tree_client()->OnChangeCompleted(change_id2, false); | 922 setup.window_tree_client()->OnChangeCompleted(change_id2, false); |
| 923 EXPECT_FALSE(child->HasCapture()); | 923 EXPECT_FALSE(child->HasCapture()); |
| 924 EXPECT_TRUE(root->HasCapture()); | 924 EXPECT_TRUE(root->HasCapture()); |
| 925 | 925 |
| 926 setup.window_tree_client()->OnLostCapture(server_id(root)); | 926 setup.window_tree_client()->OnLostCapture(server_id(root)); |
| 927 EXPECT_FALSE(root->HasCapture()); | 927 EXPECT_FALSE(root->HasCapture()); |
| 928 } | 928 } |
| 929 | 929 |
| 930 } // namespace mus | 930 } // namespace mus |
| OLD | NEW |