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

Side by Side Diff: components/mus/ws/window_tree_unittest.cc

Issue 1673783004: Hook up BeginFrameSource to SurfaceFactoryClient via SurfaceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mus unit tests Created 4 years, 9 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 <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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 410
411 } // namespace 411 } // namespace
412 412
413 // ----------------------------------------------------------------------------- 413 // -----------------------------------------------------------------------------
414 414
415 class WindowTreeTest : public testing::Test { 415 class WindowTreeTest : public testing::Test {
416 public: 416 public:
417 WindowTreeTest() 417 WindowTreeTest()
418 : wm_client_(nullptr), 418 : wm_client_(nullptr),
419 cursor_id_(0), 419 cursor_id_(0),
420 display_manager_factory_(&cursor_id_) {} 420 display_manager_factory_(&cursor_id_),
421 surfaces_state_(new SurfacesState()) {}
421 ~WindowTreeTest() override {} 422 ~WindowTreeTest() override {}
422 423
423 // WindowTreeImpl for the window manager. 424 // WindowTreeImpl for the window manager.
424 WindowTreeImpl* wm_connection() { 425 WindowTreeImpl* wm_connection() {
425 return connection_manager_->GetConnection(1); 426 return connection_manager_->GetConnection(1);
426 } 427 }
427 428
428 TestWindowTreeClient* last_window_tree_client() { 429 TestWindowTreeClient* last_window_tree_client() {
429 return delegate_.last_client(); 430 return delegate_.last_client();
430 } 431 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 void SetupEventTargeting(TestWindowTreeClient** out_client, 471 void SetupEventTargeting(TestWindowTreeClient** out_client,
471 WindowTreeImpl** window_tree_connection, 472 WindowTreeImpl** window_tree_connection,
472 ServerWindow** window); 473 ServerWindow** window);
473 474
474 protected: 475 protected:
475 // testing::Test: 476 // testing::Test:
476 void SetUp() override { 477 void SetUp() override {
477 DisplayManager::set_factory_for_testing(&display_manager_factory_); 478 DisplayManager::set_factory_for_testing(&display_manager_factory_);
478 // TODO(fsamuel): This is probably broken. We need a root. 479 // TODO(fsamuel): This is probably broken. We need a root.
479 connection_manager_.reset( 480 connection_manager_.reset(
480 new ConnectionManager(&delegate_, scoped_refptr<SurfacesState>())); 481 new ConnectionManager(&delegate_, surfaces_state_));
481 window_tree_host_ = new WindowTreeHostImpl( 482 window_tree_host_ =
482 connection_manager_.get(), nullptr, scoped_refptr<GpuState>(), 483 new WindowTreeHostImpl(connection_manager_.get(), nullptr,
483 scoped_refptr<mus::SurfacesState>()); 484 scoped_refptr<GpuState>(), surfaces_state_);
484 // TODO(fsamuel): This is way too magical. We need to find a better way to 485 // TODO(fsamuel): This is way too magical. We need to find a better way to
485 // manage lifetime. 486 // manage lifetime.
486 host_connection_ = new TestWindowTreeHostConnection( 487 host_connection_ = new TestWindowTreeHostConnection(
487 window_tree_host_, connection_manager_.get()); 488 window_tree_host_, connection_manager_.get());
488 window_tree_host_->Init(make_scoped_ptr(host_connection_)); 489 window_tree_host_->Init(make_scoped_ptr(host_connection_));
489 wm_client_ = delegate_.last_client(); 490 wm_client_ = delegate_.last_client();
490 } 491 }
491 492
492 protected: 493 protected:
493 // TestWindowTreeClient that is used for the WM connection. 494 // TestWindowTreeClient that is used for the WM connection.
494 TestWindowTreeClient* wm_client_; 495 TestWindowTreeClient* wm_client_;
495 int32_t cursor_id_; 496 int32_t cursor_id_;
496 TestDisplayManagerFactory display_manager_factory_; 497 TestDisplayManagerFactory display_manager_factory_;
497 TestConnectionManagerDelegate delegate_; 498 TestConnectionManagerDelegate delegate_;
498 TestWindowTreeHostConnection* host_connection_; 499 TestWindowTreeHostConnection* host_connection_;
499 WindowTreeHostImpl* window_tree_host_ = nullptr; 500 WindowTreeHostImpl* window_tree_host_ = nullptr;
501 scoped_refptr<SurfacesState> surfaces_state_;
500 scoped_ptr<ConnectionManager> connection_manager_; 502 scoped_ptr<ConnectionManager> connection_manager_;
501 base::MessageLoop message_loop_; 503 base::MessageLoop message_loop_;
502 504
503 DISALLOW_COPY_AND_ASSIGN(WindowTreeTest); 505 DISALLOW_COPY_AND_ASSIGN(WindowTreeTest);
504 }; 506 };
505 507
506 // Creates a new window in wm_connection(), adds it to the root, embeds a 508 // Creates a new window in wm_connection(), adds it to the root, embeds a
507 // new client in the window and creates a child of said window. |window| is 509 // new client in the window and creates a child of said window. |window| is
508 // set to the child of |window_tree_connection| that is created. 510 // set to the child of |window_tree_connection| that is created.
509 void WindowTreeTest::SetupEventTargeting( 511 void WindowTreeTest::SetupEventTargeting(
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 mojom_window_tree->ReleaseCapture(++change_id, 942 mojom_window_tree->ReleaseCapture(++change_id,
941 WindowIdToTransportId(root_window->id())); 943 WindowIdToTransportId(root_window->id()));
942 EXPECT_EQ(window, host->GetCaptureWindow()); 944 EXPECT_EQ(window, host->GetCaptureWindow());
943 mojom_window_tree->ReleaseCapture(++change_id, 945 mojom_window_tree->ReleaseCapture(++change_id,
944 WindowIdToTransportId(window->id())); 946 WindowIdToTransportId(window->id()));
945 EXPECT_EQ(nullptr, host->GetCaptureWindow()); 947 EXPECT_EQ(nullptr, host->GetCaptureWindow());
946 } 948 }
947 949
948 } // namespace ws 950 } // namespace ws
949 } // namespace mus 951 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698