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

Unified Diff: services/ui/ws/user_display_manager_unittest.cc

Issue 2461513002: Primary display change notifications. (Closed)
Patch Set: More fixes. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/user_display_manager_delegate.h ('k') | services/ui/ws/window_manager_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cbff4583e61254412789211cece44bdfd6afa646 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_;
@@ -99,6 +122,7 @@ class UserDisplayManagerTest : public testing::Test {
}
private:
+ TestPlatformScreen platform_screen_;
WindowServerTestHelper ws_test_helper_;
DISALLOW_COPY_AND_ASSIGN(UserDisplayManagerTest);
};
« no previous file with comments | « services/ui/ws/user_display_manager_delegate.h ('k') | services/ui/ws/window_manager_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698