| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "components/mus/common/types.h" | 9 #include "components/mus/common/types.h" |
| 10 #include "components/mus/common/util.h" | 10 #include "components/mus/common/util.h" |
| 11 #include "components/mus/public/interfaces/window_tree.mojom.h" | 11 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 12 #include "components/mus/surfaces/surfaces_state.h" | 12 #include "components/mus/surfaces/surfaces_state.h" |
| 13 #include "components/mus/ws/client_connection.h" | 13 #include "components/mus/ws/client_connection.h" |
| 14 #include "components/mus/ws/connection_manager.h" | 14 #include "components/mus/ws/connection_manager.h" |
| 15 #include "components/mus/ws/connection_manager_delegate.h" | 15 #include "components/mus/ws/connection_manager_delegate.h" |
| 16 #include "components/mus/ws/display_manager.h" | 16 #include "components/mus/ws/display_manager.h" |
| 17 #include "components/mus/ws/display_manager_factory.h" | 17 #include "components/mus/ws/display_manager_factory.h" |
| 18 #include "components/mus/ws/ids.h" | 18 #include "components/mus/ws/ids.h" |
| 19 #include "components/mus/ws/server_window.h" | 19 #include "components/mus/ws/server_window.h" |
| 20 #include "components/mus/ws/server_window_surface_manager_test_api.h" |
| 20 #include "components/mus/ws/test_change_tracker.h" | 21 #include "components/mus/ws/test_change_tracker.h" |
| 21 #include "components/mus/ws/window_tree_host_connection.h" | 22 #include "components/mus/ws/window_tree_host_connection.h" |
| 22 #include "components/mus/ws/window_tree_impl.h" | 23 #include "components/mus/ws/window_tree_impl.h" |
| 23 #include "mojo/application/public/interfaces/service_provider.mojom.h" | 24 #include "mojo/application/public/interfaces/service_provider.mojom.h" |
| 24 #include "mojo/converters/geometry/geometry_type_converters.h" | 25 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 25 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 26 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 27 #include "ui/gfx/geometry/rect.h" | 28 #include "ui/gfx/geometry/rect.h" |
| 28 | 29 |
| 29 using mojo::Array; | 30 using mojo::Array; |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 connection_manager() | 403 connection_manager() |
| 403 ->GetWindow(embed_window_id) | 404 ->GetWindow(embed_window_id) |
| 404 ->SetBounds(gfx::Rect(0, 0, 50, 50)); | 405 ->SetBounds(gfx::Rect(0, 0, 50, 50)); |
| 405 | 406 |
| 406 const WindowId child1(connection1->id(), 1); | 407 const WindowId child1(connection1->id(), 1); |
| 407 EXPECT_TRUE(connection1->NewWindow(child1, ServerWindow::Properties())); | 408 EXPECT_TRUE(connection1->NewWindow(child1, ServerWindow::Properties())); |
| 408 EXPECT_TRUE(connection1->AddWindow(embed_window_id, child1)); | 409 EXPECT_TRUE(connection1->AddWindow(embed_window_id, child1)); |
| 409 ServerWindow* v1 = connection1->GetWindow(child1); | 410 ServerWindow* v1 = connection1->GetWindow(child1); |
| 410 v1->SetVisible(true); | 411 v1->SetVisible(true); |
| 411 v1->SetBounds(gfx::Rect(20, 20, 20, 20)); | 412 v1->SetBounds(gfx::Rect(20, 20, 20, 20)); |
| 413 EnableHitTest(v1); |
| 412 | 414 |
| 413 TestWindowTreeClient* connection1_client = last_window_tree_client(); | 415 TestWindowTreeClient* connection1_client = last_window_tree_client(); |
| 414 connection1_client->tracker()->changes()->clear(); | 416 connection1_client->tracker()->changes()->clear(); |
| 415 wm_client()->tracker()->changes()->clear(); | 417 wm_client()->tracker()->changes()->clear(); |
| 416 | 418 |
| 417 // Focus should not go to |child1| yet, since the parent still doesn't allow | 419 // Focus should not go to |child1| yet, since the parent still doesn't allow |
| 418 // active children. | 420 // active children. |
| 419 DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22)); | 421 DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22)); |
| 420 EXPECT_EQ(nullptr, connection1->GetHost()->GetFocusedWindow()); | 422 EXPECT_EQ(nullptr, connection1->GetHost()->GetFocusedWindow()); |
| 421 DispatchEventAndAckImmediately(CreatePointerUpEvent(21, 22)); | 423 DispatchEventAndAckImmediately(CreatePointerUpEvent(21, 22)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 492 |
| 491 const WindowId child1(connection1->id(), 1); | 493 const WindowId child1(connection1->id(), 1); |
| 492 EXPECT_TRUE(connection1->NewWindow(child1, ServerWindow::Properties())); | 494 EXPECT_TRUE(connection1->NewWindow(child1, ServerWindow::Properties())); |
| 493 EXPECT_TRUE(connection1->AddWindow(embed_window_id, child1)); | 495 EXPECT_TRUE(connection1->AddWindow(embed_window_id, child1)); |
| 494 connection1->GetHost()->AddActivationParent( | 496 connection1->GetHost()->AddActivationParent( |
| 495 WindowIdToTransportId(embed_window_id)); | 497 WindowIdToTransportId(embed_window_id)); |
| 496 | 498 |
| 497 ServerWindow* v1 = connection1->GetWindow(child1); | 499 ServerWindow* v1 = connection1->GetWindow(child1); |
| 498 v1->SetVisible(true); | 500 v1->SetVisible(true); |
| 499 v1->SetBounds(gfx::Rect(20, 20, 20, 20)); | 501 v1->SetBounds(gfx::Rect(20, 20, 20, 20)); |
| 502 EnableHitTest(v1); |
| 500 | 503 |
| 501 TestWindowTreeClient* embed_connection = last_window_tree_client(); | 504 TestWindowTreeClient* embed_connection = last_window_tree_client(); |
| 502 embed_connection->tracker()->changes()->clear(); | 505 embed_connection->tracker()->changes()->clear(); |
| 503 wm_client()->tracker()->changes()->clear(); | 506 wm_client()->tracker()->changes()->clear(); |
| 504 | 507 |
| 505 // Send an event to |v1|. |embed_connection| should get the event, not | 508 // Send an event to |v1|. |embed_connection| should get the event, not |
| 506 // |wm_client|, since |v1| lives inside an embedded window. | 509 // |wm_client|, since |v1| lives inside an embedded window. |
| 507 DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22)); | 510 DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22)); |
| 508 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()); | 511 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()); |
| 509 EXPECT_EQ("Focused id=2,1", | 512 EXPECT_EQ("Focused id=2,1", |
| (...skipping 29 matching lines...) Expand all Loading... |
| 539 // Ack the first event. That should trigger the dispatch of the second event. | 542 // Ack the first event. That should trigger the dispatch of the second event. |
| 540 AckPreviousEvent(); | 543 AckPreviousEvent(); |
| 541 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()); | 544 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()); |
| 542 EXPECT_EQ("InputEvent window=0,2 event_action=5", | 545 EXPECT_EQ("InputEvent window=0,2 event_action=5", |
| 543 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); | 546 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); |
| 544 } | 547 } |
| 545 | 548 |
| 546 } // namespace ws | 549 } // namespace ws |
| 547 | 550 |
| 548 } // namespace mus | 551 } // namespace mus |
| OLD | NEW |