| 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/view_manager/client_connection.h" | 9 #include "components/view_manager/client_connection.h" |
| 10 #include "components/view_manager/connection_manager.h" | 10 #include "components/view_manager/connection_manager.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 tracker_.OnEmbed(connection_id, root.Pass()); | 57 tracker_.OnEmbed(connection_id, root.Pass()); |
| 58 } | 58 } |
| 59 void OnEmbedForDescendant( | 59 void OnEmbedForDescendant( |
| 60 uint32_t view, | 60 uint32_t view, |
| 61 mojo::URLRequestPtr request, | 61 mojo::URLRequestPtr request, |
| 62 const OnEmbedForDescendantCallback& callback) override {} | 62 const OnEmbedForDescendantCallback& callback) override {} |
| 63 void OnEmbeddedAppDisconnected(uint32_t view) override { | 63 void OnEmbeddedAppDisconnected(uint32_t view) override { |
| 64 tracker_.OnEmbeddedAppDisconnected(view); | 64 tracker_.OnEmbeddedAppDisconnected(view); |
| 65 } | 65 } |
| 66 void OnUnembed() override { tracker_.OnUnembed(); } | 66 void OnUnembed() override { tracker_.OnUnembed(); } |
| 67 void OnResourcesReturned( |
| 68 mojo::Array<mojo::ReturnedResourcePtr> resources) override { |
| 69 } |
| 67 void OnViewBoundsChanged(uint32_t view, | 70 void OnViewBoundsChanged(uint32_t view, |
| 68 mojo::RectPtr old_bounds, | 71 mojo::RectPtr old_bounds, |
| 69 mojo::RectPtr new_bounds) override { | 72 mojo::RectPtr new_bounds) override { |
| 70 tracker_.OnViewBoundsChanged(view, old_bounds.Pass(), new_bounds.Pass()); | 73 tracker_.OnViewBoundsChanged(view, old_bounds.Pass(), new_bounds.Pass()); |
| 71 } | 74 } |
| 72 void OnViewViewportMetricsChanged( | 75 void OnViewViewportMetricsChanged( |
| 73 mojo::ViewportMetricsPtr old_metrics, | 76 mojo::ViewportMetricsPtr old_metrics, |
| 74 mojo::ViewportMetricsPtr new_metrics) override { | 77 mojo::ViewportMetricsPtr new_metrics) override { |
| 75 tracker_.OnViewViewportMetricsChanged(old_metrics.Pass(), | 78 tracker_.OnViewViewportMetricsChanged(old_metrics.Pass(), |
| 76 new_metrics.Pass()); | 79 new_metrics.Pass()); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 296 |
| 294 TestViewManagerClient* wm_client() { return wm_client_; } | 297 TestViewManagerClient* wm_client() { return wm_client_; } |
| 295 | 298 |
| 296 TestViewManagerRootConnection* root_connection() { return root_connection_; } | 299 TestViewManagerRootConnection* root_connection() { return root_connection_; } |
| 297 | 300 |
| 298 protected: | 301 protected: |
| 299 // testing::Test: | 302 // testing::Test: |
| 300 void SetUp() override { | 303 void SetUp() override { |
| 301 DisplayManager::set_factory_for_testing(&display_manager_factory_); | 304 DisplayManager::set_factory_for_testing(&display_manager_factory_); |
| 302 // TODO(fsamuel): This is probably broken. We need a root. | 305 // TODO(fsamuel): This is probably broken. We need a root. |
| 303 connection_manager_.reset(new ConnectionManager(&delegate_)); | 306 connection_manager_.reset( |
| 307 new ConnectionManager(&delegate_, |
| 308 scoped_refptr<surfaces::SurfacesState>())); |
| 304 ViewManagerRootImpl* root = new ViewManagerRootImpl( | 309 ViewManagerRootImpl* root = new ViewManagerRootImpl( |
| 305 connection_manager_.get(), true /* is_headless */, nullptr, | 310 connection_manager_.get(), true /* is_headless */, nullptr, |
| 306 scoped_refptr<gles2::GpuState>(), | 311 scoped_refptr<gles2::GpuState>(), |
| 307 scoped_refptr<surfaces::SurfacesState>()); | 312 scoped_refptr<surfaces::SurfacesState>()); |
| 308 // TODO(fsamuel): This is way too magical. We need to find a better way to | 313 // TODO(fsamuel): This is way too magical. We need to find a better way to |
| 309 // manage lifetime. | 314 // manage lifetime. |
| 310 root_connection_ = new TestViewManagerRootConnection( | 315 root_connection_ = new TestViewManagerRootConnection( |
| 311 make_scoped_ptr(root), connection_manager_.get()); | 316 make_scoped_ptr(root), connection_manager_.get()); |
| 312 root->Init(root_connection_); | 317 root->Init(root_connection_); |
| 313 wm_client_ = delegate_.last_client(); | 318 wm_client_ = delegate_.last_client(); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 CreatePointerDownEvent(61, 22)); | 608 CreatePointerDownEvent(61, 22)); |
| 604 EXPECT_EQ(root_connection()->view_manager_root()->root_view(), | 609 EXPECT_EQ(root_connection()->view_manager_root()->root_view(), |
| 605 connection_manager()->GetFocusedView()); | 610 connection_manager()->GetFocusedView()); |
| 606 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u); | 611 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u); |
| 607 EXPECT_EQ("InputEvent view=0,2 event_action=4", | 612 EXPECT_EQ("InputEvent view=0,2 event_action=4", |
| 608 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); | 613 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); |
| 609 EXPECT_TRUE(connection1_client->tracker()->changes()->empty()); | 614 EXPECT_TRUE(connection1_client->tracker()->changes()->empty()); |
| 610 } | 615 } |
| 611 | 616 |
| 612 } // namespace view_manager | 617 } // namespace view_manager |
| OLD | NEW |