Chromium Code Reviews| Index: services/ui/ws/user_display_manager_unittest.cc |
| diff --git a/services/ui/ws/user_display_manager_unittest.cc b/services/ui/ws/user_display_manager_unittest.cc |
| index 957d1a4aa3adc94a56d19b4aa3ad5ae246f61166..aa7c65e4e702c06f68914bdabb116383e333f8b1 100644 |
| --- a/services/ui/ws/user_display_manager_unittest.cc |
| +++ b/services/ui/ws/user_display_manager_unittest.cc |
| @@ -12,6 +12,7 @@ |
| #include "base/strings/string_number_conversions.h" |
| #include "services/ui/common/types.h" |
| #include "services/ui/common/util.h" |
| +#include "services/ui/display/platform_screen.h" |
| #include "services/ui/public/interfaces/window_tree.mojom.h" |
| #include "services/ui/surfaces/display_compositor.h" |
| #include "services/ui/ws/display_manager.h" |
| @@ -35,6 +36,23 @@ namespace ws { |
| namespace test { |
| namespace { |
| +// Stub PlatformScreen implementation so PlatformScreen::GetInstance() doesn't |
| +// fail. |
| +class TestPlatformScreen : public display::PlatformScreen { |
| + public: |
| + TestPlatformScreen() {} |
| + ~TestPlatformScreen() override {} |
| + |
| + // display::PlatformScreen: |
| + void AddInterfaces(service_manager::InterfaceRegistry* registry) override {} |
| + void Init(display::PlatformScreenDelegate* delegate) override {} |
| + void RequestCloseDisplay(int64_t display_id) override {} |
| + int64_t GetPrimaryDisplayId() const override { return 1; } |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(TestPlatformScreen); |
| +}; |
| + |
| class TestDisplayManagerObserver : public mojom::DisplayManagerObserver { |
| public: |
| TestDisplayManagerObserver() {} |
| @@ -65,7 +83,9 @@ class TestDisplayManagerObserver : public mojom::DisplayManagerObserver { |
| } |
| // mojom::DisplayManagerObserver: |
| - void OnDisplays(mojo::Array<mojom::WsDisplayPtr> displays) override { |
| + void OnDisplays(mojo::Array<mojom::WsDisplayPtr> displays, |
| + int64_t primary_display_id, |
| + int64_t internal_display_id) override { |
| AddCall("OnDisplays " + DisplayIdsToString(displays)); |
| } |
| void OnDisplaysChanged(mojo::Array<mojom::WsDisplayPtr> displays) override { |
| @@ -74,6 +94,9 @@ class TestDisplayManagerObserver : public mojom::DisplayManagerObserver { |
| void OnDisplayRemoved(int64_t id) override { |
| AddCall("OnDisplayRemoved " + base::Int64ToString(id)); |
| } |
| + void OnPrimaryDisplayChanged(int64_t id) override { |
| + AddCall("OnPrimaryDisplayChanged " + base::Int64ToString(id)); |
| + } |
| std::string observer_calls_; |
| @@ -90,7 +113,8 @@ mojom::FrameDecorationValuesPtr CreateDefaultFrameDecorationValues() { |
| class UserDisplayManagerTest : public testing::Test { |
| public: |
| - UserDisplayManagerTest() {} |
| + UserDisplayManagerTest() |
| + : platform_screen_(base::MakeUnique<TestPlatformScreen>()) {} |
| ~UserDisplayManagerTest() override {} |
| WindowServer* window_server() { return ws_test_helper_.window_server(); } |
| @@ -99,6 +123,7 @@ class UserDisplayManagerTest : public testing::Test { |
| } |
| private: |
| + std::unique_ptr<display::PlatformScreen> platform_screen_; |
|
sky
2016/10/28 19:59:36
optional: nuke unique_ptr and use value here.
kylechar
2016/10/28 20:43:52
Done.
|
| WindowServerTestHelper ws_test_helper_; |
| DISALLOW_COPY_AND_ASSIGN(UserDisplayManagerTest); |
| }; |