Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: components/view_manager/view_manager_service_unittest.cc

Issue 1245683004: Mandoline: Merge Surfaces and Views apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove context_provider.mojom Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "components/view_manager/connection_manager_delegate.h" 11 #include "components/view_manager/connection_manager_delegate.h"
12 #include "components/view_manager/display_manager.h" 12 #include "components/view_manager/display_manager.h"
13 #include "components/view_manager/display_manager_factory.h" 13 #include "components/view_manager/display_manager_factory.h"
14 #include "components/view_manager/ids.h" 14 #include "components/view_manager/ids.h"
15 #include "components/view_manager/public/cpp/types.h" 15 #include "components/view_manager/public/cpp/types.h"
16 #include "components/view_manager/public/cpp/util.h" 16 #include "components/view_manager/public/cpp/util.h"
17 #include "components/view_manager/public/interfaces/view_manager.mojom.h" 17 #include "components/view_manager/public/interfaces/view_manager.mojom.h"
18 #include "components/view_manager/server_view.h" 18 #include "components/view_manager/server_view.h"
19 #include "components/view_manager/surfaces/surfaces_state.h"
19 #include "components/view_manager/test_change_tracker.h" 20 #include "components/view_manager/test_change_tracker.h"
20 #include "components/view_manager/view_manager_root_connection.h" 21 #include "components/view_manager/view_manager_root_connection.h"
21 #include "components/view_manager/view_manager_service_impl.h" 22 #include "components/view_manager/view_manager_service_impl.h"
22 #include "mojo/application/public/interfaces/service_provider.mojom.h" 23 #include "mojo/application/public/interfaces/service_provider.mojom.h"
23 #include "mojo/converters/geometry/geometry_type_converters.h" 24 #include "mojo/converters/geometry/geometry_type_converters.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 #include "ui/gfx/geometry/rect.h" 26 #include "ui/gfx/geometry/rect.h"
26 27
27 using mojo::Array; 28 using mojo::Array;
28 using mojo::ERROR_CODE_NONE; 29 using mojo::ERROR_CODE_NONE;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 }; 228 };
228 229
229 // Factory that dispenses TestDisplayManagers. 230 // Factory that dispenses TestDisplayManagers.
230 class TestDisplayManagerFactory : public DisplayManagerFactory { 231 class TestDisplayManagerFactory : public DisplayManagerFactory {
231 public: 232 public:
232 TestDisplayManagerFactory() {} 233 TestDisplayManagerFactory() {}
233 ~TestDisplayManagerFactory() {} 234 ~TestDisplayManagerFactory() {}
234 DisplayManager* CreateDisplayManager( 235 DisplayManager* CreateDisplayManager(
235 bool is_headless, 236 bool is_headless,
236 mojo::ApplicationImpl* app_impl, 237 mojo::ApplicationImpl* app_impl,
237 const scoped_refptr<gles2::GpuState>& gpu_state) override { 238 const scoped_refptr<gles2::GpuState>& gpu_state,
239 const scoped_refptr<surfaces::SurfacesState>& surfaces_state) override {
238 return new TestDisplayManager(); 240 return new TestDisplayManager();
239 } 241 }
240 242
241 private: 243 private:
242 DISALLOW_COPY_AND_ASSIGN(TestDisplayManagerFactory); 244 DISALLOW_COPY_AND_ASSIGN(TestDisplayManagerFactory);
243 }; 245 };
244 246
245 mojo::EventPtr CreatePointerDownEvent(int x, int y) { 247 mojo::EventPtr CreatePointerDownEvent(int x, int y) {
246 mojo::EventPtr event(mojo::Event::New()); 248 mojo::EventPtr event(mojo::Event::New());
247 event->action = mojo::EVENT_TYPE_POINTER_DOWN; 249 event->action = mojo::EVENT_TYPE_POINTER_DOWN;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 TestViewManagerRootConnection* root_connection() { return root_connection_; } 293 TestViewManagerRootConnection* root_connection() { return root_connection_; }
292 294
293 protected: 295 protected:
294 // testing::Test: 296 // testing::Test:
295 void SetUp() override { 297 void SetUp() override {
296 DisplayManager::set_factory_for_testing(&display_manager_factory_); 298 DisplayManager::set_factory_for_testing(&display_manager_factory_);
297 // TODO(fsamuel): This is probably broken. We need a root. 299 // TODO(fsamuel): This is probably broken. We need a root.
298 connection_manager_.reset(new ConnectionManager(&delegate_)); 300 connection_manager_.reset(new ConnectionManager(&delegate_));
299 ViewManagerRootImpl* root = new ViewManagerRootImpl( 301 ViewManagerRootImpl* root = new ViewManagerRootImpl(
300 connection_manager_.get(), true /* is_headless */, nullptr, 302 connection_manager_.get(), true /* is_headless */, nullptr,
301 scoped_refptr<gles2::GpuState>()); 303 scoped_refptr<gles2::GpuState>(),
304 scoped_refptr<surfaces::SurfacesState>());
302 // TODO(fsamuel): This is way too magical. We need to find a better way to 305 // TODO(fsamuel): This is way too magical. We need to find a better way to
303 // manage lifetime. 306 // manage lifetime.
304 root_connection_ = new TestViewManagerRootConnection( 307 root_connection_ = new TestViewManagerRootConnection(
305 make_scoped_ptr(root), connection_manager_.get()); 308 make_scoped_ptr(root), connection_manager_.get());
306 root->Init(root_connection_); 309 root->Init(root_connection_);
307 wm_client_ = delegate_.last_client(); 310 wm_client_ = delegate_.last_client();
308 } 311 }
309 312
310 private: 313 private:
311 // TestViewManagerClient that is used for the WM connection. 314 // TestViewManagerClient that is used for the WM connection.
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 CreatePointerDownEvent(61, 22)); 600 CreatePointerDownEvent(61, 22));
598 EXPECT_EQ(root_connection()->view_manager_root()->root_view(), 601 EXPECT_EQ(root_connection()->view_manager_root()->root_view(),
599 connection_manager()->GetFocusedView()); 602 connection_manager()->GetFocusedView());
600 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u); 603 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u);
601 EXPECT_EQ("InputEvent view=0,2 event_action=4", 604 EXPECT_EQ("InputEvent view=0,2 event_action=4",
602 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); 605 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
603 EXPECT_TRUE(connection1_client->tracker()->changes()->empty()); 606 EXPECT_TRUE(connection1_client->tracker()->changes()->empty());
604 } 607 }
605 608
606 } // namespace view_manager 609 } // namespace view_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698