| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 } // namespace | 157 } // namespace |
| 158 | 158 |
| 159 // ----------------------------------------------------------------------------- | 159 // ----------------------------------------------------------------------------- |
| 160 | 160 |
| 161 class WindowTreeTest : public testing::Test { | 161 class WindowTreeTest : public testing::Test { |
| 162 public: | 162 public: |
| 163 WindowTreeTest() | 163 WindowTreeTest() |
| 164 : wm_client_(nullptr), | 164 : wm_client_(nullptr), |
| 165 cursor_id_(0), | 165 cursor_id_(0), |
| 166 platform_display_factory_(&cursor_id_) {} | 166 platform_display_factory_(&cursor_id_), |
| 167 surfaces_state_(new SurfacesState()) {} |
| 167 ~WindowTreeTest() override {} | 168 ~WindowTreeTest() override {} |
| 168 | 169 |
| 169 // WindowTree for the window manager. | 170 // WindowTree for the window manager. |
| 170 WindowTree* wm_tree() { return connection_manager_->GetTreeWithId(1); } | 171 WindowTree* wm_tree() { return connection_manager_->GetTreeWithId(1); } |
| 171 | 172 |
| 172 TestWindowTreeClient* last_window_tree_client() { | 173 TestWindowTreeClient* last_window_tree_client() { |
| 173 return delegate_.last_client(); | 174 return delegate_.last_client(); |
| 174 } | 175 } |
| 175 | 176 |
| 176 TestWindowTreeBinding* last_binding() { return delegate_.last_binding(); } | 177 TestWindowTreeBinding* last_binding() { return delegate_.last_binding(); } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // it. | 211 // it. |
| 211 void SetupEventTargeting(TestWindowTreeClient** out_client, | 212 void SetupEventTargeting(TestWindowTreeClient** out_client, |
| 212 WindowTree** window_tree, | 213 WindowTree** window_tree, |
| 213 ServerWindow** window); | 214 ServerWindow** window); |
| 214 | 215 |
| 215 protected: | 216 protected: |
| 216 // testing::Test: | 217 // testing::Test: |
| 217 void SetUp() override { | 218 void SetUp() override { |
| 218 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); | 219 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); |
| 219 connection_manager_.reset( | 220 connection_manager_.reset( |
| 220 new ConnectionManager(&delegate_, scoped_refptr<SurfacesState>())); | 221 new ConnectionManager(&delegate_, surfaces_state_)); |
| 221 display_ = new Display(connection_manager_.get(), nullptr, | 222 display_ = new Display(connection_manager_.get(), nullptr, |
| 222 scoped_refptr<GpuState>(), | 223 scoped_refptr<GpuState>(), |
| 223 scoped_refptr<mus::SurfacesState>()); | 224 surfaces_state_); |
| 224 display_binding_ = | 225 display_binding_ = |
| 225 new TestDisplayBinding(display_, connection_manager_.get()); | 226 new TestDisplayBinding(display_, connection_manager_.get()); |
| 226 display_->Init(make_scoped_ptr(display_binding_)); | 227 display_->Init(make_scoped_ptr(display_binding_)); |
| 227 wm_client_ = delegate_.last_client(); | 228 wm_client_ = delegate_.last_client(); |
| 228 } | 229 } |
| 229 | 230 |
| 230 protected: | 231 protected: |
| 231 // TestWindowTreeClient that is used for the WM connection. | 232 // TestWindowTreeClient that is used for the WM connection. |
| 232 TestWindowTreeClient* wm_client_; | 233 TestWindowTreeClient* wm_client_; |
| 233 int32_t cursor_id_; | 234 int32_t cursor_id_; |
| 234 TestPlatformDisplayFactory platform_display_factory_; | 235 TestPlatformDisplayFactory platform_display_factory_; |
| 235 TestConnectionManagerDelegate delegate_; | 236 TestConnectionManagerDelegate delegate_; |
| 236 // Owned by ConnectionManager. | 237 // Owned by ConnectionManager. |
| 237 TestDisplayBinding* display_binding_; | 238 TestDisplayBinding* display_binding_; |
| 238 Display* display_ = nullptr; | 239 Display* display_ = nullptr; |
| 240 scoped_refptr<SurfacesState> surfaces_state_; |
| 239 scoped_ptr<ConnectionManager> connection_manager_; | 241 scoped_ptr<ConnectionManager> connection_manager_; |
| 240 base::MessageLoop message_loop_; | 242 base::MessageLoop message_loop_; |
| 241 | 243 |
| 242 DISALLOW_COPY_AND_ASSIGN(WindowTreeTest); | 244 DISALLOW_COPY_AND_ASSIGN(WindowTreeTest); |
| 243 }; | 245 }; |
| 244 | 246 |
| 245 // Creates a new window in wm_tree(), adds it to the root, embeds a | 247 // Creates a new window in wm_tree(), adds it to the root, embeds a |
| 246 // new client in the window and creates a child of said window. |window| is | 248 // new client in the window and creates a child of said window. |window| is |
| 247 // set to the child of |window_tree| that is created. | 249 // set to the child of |window_tree| that is created. |
| 248 void WindowTreeTest::SetupEventTargeting(TestWindowTreeClient** out_client, | 250 void WindowTreeTest::SetupEventTargeting(TestWindowTreeClient** out_client, |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 WindowIdToTransportId(root_window->id())); | 657 WindowIdToTransportId(root_window->id())); |
| 656 EXPECT_EQ(window, display->GetCaptureWindow()); | 658 EXPECT_EQ(window, display->GetCaptureWindow()); |
| 657 mojom_window_tree->ReleaseCapture(++change_id, | 659 mojom_window_tree->ReleaseCapture(++change_id, |
| 658 WindowIdToTransportId(window->id())); | 660 WindowIdToTransportId(window->id())); |
| 659 EXPECT_EQ(nullptr, display->GetCaptureWindow()); | 661 EXPECT_EQ(nullptr, display->GetCaptureWindow()); |
| 660 } | 662 } |
| 661 | 663 |
| 662 } // namespace test | 664 } // namespace test |
| 663 } // namespace ws | 665 } // namespace ws |
| 664 } // namespace mus | 666 } // namespace mus |
| OLD | NEW |