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

Unified Diff: ash/display/display_controller_unittest.cc

Issue 17099003: Use primary display as hangout/gtalk broadcast window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « ash/display/display_controller.cc ('k') | ui/aura/root_window_host_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_controller_unittest.cc
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc
index 7b41a51879c8dd32fc15e8d4d8cd0cd5ed47b1a0..84017cecf10a80dedbba99cf410a4b63d00a670a 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -21,6 +21,12 @@
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
+#if defined(USE_X11)
+#include "ui/base/x/x11_util.h"
+#include <X11/Xlib.h>
+#undef RootWindow
+#endif
+
namespace ash {
namespace test {
namespace {
@@ -184,6 +190,21 @@ float GetStoredUIScale(int64 id) {
return Shell::GetInstance()->display_manager()->GetDisplayInfo(id).ui_scale();
}
+#if defined(USE_X11)
+void GetPrimaryAndSeconary(aura::RootWindow** primary,
+ aura::RootWindow** secondary) {
+ *primary = Shell::GetPrimaryRootWindow();
+ Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
+ *secondary = root_windows[0] == *primary ? root_windows[1] : root_windows[0];
+}
+
+std::string GetXWindowName(aura::RootWindow* window) {
+ char* name = NULL;
+ XFetchName(ui::GetXDisplay(), window->GetAcceleratedWidget(), &name);
+ return std::string(name);
+}
+#endif
+
} // namespace
typedef test::AshTestBase DisplayControllerTest;
@@ -933,5 +954,29 @@ TEST_F(DisplayControllerTest, ConvertHostToRootCoords) {
Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
}
+#if defined(USE_X11)
+TEST_F(DisplayControllerTest, XWidowNameForRootWindow) {
+ EXPECT_EQ("aura_root_0", GetXWindowName(Shell::GetPrimaryRootWindow()));
+
+ // Multiple display.
+ UpdateDisplay("200x200,300x300");
+ aura::RootWindow* primary, *secondary;
+ GetPrimaryAndSeconary(&primary, &secondary);
+ EXPECT_EQ("aura_root_0", GetXWindowName(primary));
+ EXPECT_EQ("aura_root_x", GetXWindowName(secondary));
+
+ // Swap primary.
+ primary = secondary = NULL;
+ Shell::GetInstance()->display_controller()->SwapPrimaryDisplay();
+ GetPrimaryAndSeconary(&primary, &secondary);
+ EXPECT_EQ("aura_root_0", GetXWindowName(primary));
+ EXPECT_EQ("aura_root_x", GetXWindowName(secondary));
+
+ // Switching back to single display.
+ UpdateDisplay("300x400");
+ EXPECT_EQ("aura_root_0", GetXWindowName(Shell::GetPrimaryRootWindow()));
+}
+#endif
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/display/display_controller.cc ('k') | ui/aura/root_window_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698