| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 change_completed_run_loop_->Quit(); | 426 change_completed_run_loop_->Quit(); |
| 427 } | 427 } |
| 428 } | 428 } |
| 429 void RequestClose(uint32_t window_id) override {} | 429 void RequestClose(uint32_t window_id) override {} |
| 430 void GetWindowManager(mojo::AssociatedInterfaceRequest<mojom::WindowManager> | 430 void GetWindowManager(mojo::AssociatedInterfaceRequest<mojom::WindowManager> |
| 431 internal) override { | 431 internal) override { |
| 432 window_manager_binding_ = | 432 window_manager_binding_ = |
| 433 base::MakeUnique<mojo::AssociatedBinding<mojom::WindowManager>>( | 433 base::MakeUnique<mojo::AssociatedBinding<mojom::WindowManager>>( |
| 434 this, std::move(internal)); | 434 this, std::move(internal)); |
| 435 tree_->GetWindowManagerClient( | 435 tree_->GetWindowManagerClient( |
| 436 GetProxy(&window_manager_client_, tree_.associated_group())); | 436 MakeRequest(&window_manager_client_, tree_.associated_group())); |
| 437 } | 437 } |
| 438 | 438 |
| 439 // mojom::WindowManager: | 439 // mojom::WindowManager: |
| 440 void OnConnect(uint16_t client_id) override {} | 440 void OnConnect(uint16_t client_id) override {} |
| 441 void WmNewDisplayAdded(const display::Display& display, | 441 void WmNewDisplayAdded(const display::Display& display, |
| 442 mojom::WindowDataPtr root_data, | 442 mojom::WindowDataPtr root_data, |
| 443 bool drawn) override { | 443 bool drawn) override { |
| 444 NOTIMPLEMENTED(); | 444 NOTIMPLEMENTED(); |
| 445 } | 445 } |
| 446 void WmDisplayRemoved(int64_t display_id) override { NOTIMPLEMENTED(); } | 446 void WmDisplayRemoved(int64_t display_id) override { NOTIMPLEMENTED(); } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 void SetUp() override { | 650 void SetUp() override { |
| 651 client_factory_ = base::MakeUnique<WindowTreeClientFactory>(); | 651 client_factory_ = base::MakeUnique<WindowTreeClientFactory>(); |
| 652 | 652 |
| 653 WindowServerServiceTestBase::SetUp(); | 653 WindowServerServiceTestBase::SetUp(); |
| 654 | 654 |
| 655 mojom::WindowTreeHostFactoryPtr factory; | 655 mojom::WindowTreeHostFactoryPtr factory; |
| 656 connector()->ConnectToInterface(ui::mojom::kServiceName, &factory); | 656 connector()->ConnectToInterface(ui::mojom::kServiceName, &factory); |
| 657 | 657 |
| 658 mojom::WindowTreeClientPtr tree_client_ptr; | 658 mojom::WindowTreeClientPtr tree_client_ptr; |
| 659 wt_client1_ = base::MakeUnique<TestWindowTreeClient>(); | 659 wt_client1_ = base::MakeUnique<TestWindowTreeClient>(); |
| 660 wt_client1_->Bind(GetProxy(&tree_client_ptr)); | 660 wt_client1_->Bind(MakeRequest(&tree_client_ptr)); |
| 661 | 661 |
| 662 factory->CreateWindowTreeHost(GetProxy(&host_), | 662 factory->CreateWindowTreeHost(MakeRequest(&host_), |
| 663 std::move(tree_client_ptr)); | 663 std::move(tree_client_ptr)); |
| 664 | 664 |
| 665 // Next we should get an embed call on the "window manager" client. | 665 // Next we should get an embed call on the "window manager" client. |
| 666 wt_client1_->WaitForOnEmbed(); | 666 wt_client1_->WaitForOnEmbed(); |
| 667 | 667 |
| 668 ASSERT_EQ(1u, changes1()->size()); | 668 ASSERT_EQ(1u, changes1()->size()); |
| 669 EXPECT_EQ(CHANGE_TYPE_EMBED, (*changes1())[0].type); | 669 EXPECT_EQ(CHANGE_TYPE_EMBED, (*changes1())[0].type); |
| 670 // All these tests assume 1 for the client id. The only real assertion here | 670 // All these tests assume 1 for the client id. The only real assertion here |
| 671 // is the client id is not zero, but adding this as rest of code here | 671 // is the client id is not zero, but adding this as rest of code here |
| 672 // assumes 1. | 672 // assumes 1. |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 wt_client1()->WaitForChangeCount(1); | 2150 wt_client1()->WaitForChangeCount(1); |
| 2151 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101_in_ws1) + | 2151 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101_in_ws1) + |
| 2152 " old_parent=null new_parent=" + IdToString(window_1_100), | 2152 " old_parent=null new_parent=" + IdToString(window_1_100), |
| 2153 SingleChangeToDescription(*changes1())); | 2153 SingleChangeToDescription(*changes1())); |
| 2154 changes1()->clear(); | 2154 changes1()->clear(); |
| 2155 | 2155 |
| 2156 // Submit a CompositorFrame to window_2_101 and make sure server gets it. | 2156 // Submit a CompositorFrame to window_2_101 and make sure server gets it. |
| 2157 cc::mojom::MojoCompositorFrameSinkPtr surface_ptr; | 2157 cc::mojom::MojoCompositorFrameSinkPtr surface_ptr; |
| 2158 cc::mojom::MojoCompositorFrameSinkClientRequest client_request; | 2158 cc::mojom::MojoCompositorFrameSinkClientRequest client_request; |
| 2159 cc::mojom::MojoCompositorFrameSinkClientPtr surface_client_ptr; | 2159 cc::mojom::MojoCompositorFrameSinkClientPtr surface_client_ptr; |
| 2160 client_request = mojo::GetProxy(&surface_client_ptr); | 2160 client_request = mojo::MakeRequest(&surface_client_ptr); |
| 2161 wt2()->AttachCompositorFrameSink( | 2161 wt2()->AttachCompositorFrameSink( |
| 2162 window_2_101, mojom::CompositorFrameSinkType::DEFAULT, | 2162 window_2_101, mojom::CompositorFrameSinkType::DEFAULT, |
| 2163 mojo::GetProxy(&surface_ptr), std::move(surface_client_ptr)); | 2163 mojo::MakeRequest(&surface_ptr), std::move(surface_client_ptr)); |
| 2164 cc::CompositorFrame compositor_frame; | 2164 cc::CompositorFrame compositor_frame; |
| 2165 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); | 2165 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); |
| 2166 gfx::Rect frame_rect(0, 0, 100, 100); | 2166 gfx::Rect frame_rect(0, 0, 100, 100); |
| 2167 render_pass->SetNew(1, frame_rect, frame_rect, gfx::Transform()); | 2167 render_pass->SetNew(1, frame_rect, frame_rect, gfx::Transform()); |
| 2168 compositor_frame.render_pass_list.push_back(std::move(render_pass)); | 2168 compositor_frame.render_pass_list.push_back(std::move(render_pass)); |
| 2169 compositor_frame.metadata.device_scale_factor = 1.f; | 2169 compositor_frame.metadata.device_scale_factor = 1.f; |
| 2170 cc::LocalFrameId local_frame_id(1, base::UnguessableToken::Create()); | 2170 cc::LocalFrameId local_frame_id(1, base::UnguessableToken::Create()); |
| 2171 surface_ptr->SubmitCompositorFrame(local_frame_id, | 2171 surface_ptr->SubmitCompositorFrame(local_frame_id, |
| 2172 std::move(compositor_frame)); | 2172 std::move(compositor_frame)); |
| 2173 // Make sure the parent connection gets the surface ID. | 2173 // Make sure the parent connection gets the surface ID. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2216 | 2216 |
| 2217 // TODO(sky): make sure coverage of what was | 2217 // TODO(sky): make sure coverage of what was |
| 2218 // WindowManagerTest.SecondEmbedRoot_InitService and | 2218 // WindowManagerTest.SecondEmbedRoot_InitService and |
| 2219 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window | 2219 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window |
| 2220 // manager | 2220 // manager |
| 2221 // tests. | 2221 // tests. |
| 2222 | 2222 |
| 2223 } // namespace test | 2223 } // namespace test |
| 2224 } // namespace ws | 2224 } // namespace ws |
| 2225 } // namespace ui | 2225 } // namespace ui |
| OLD | NEW |