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