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

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
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..7f458f63274019baa54a50720b22b7bff12d8065 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 {
@@ -933,5 +939,42 @@ TEST_F(DisplayControllerTest, ConvertHostToRootCoords) {
Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
}
+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];
Josh Horwich 2013/06/14 22:44:03 I know that right now the function will only be in
oshima 2013/06/14 23:10:01 For single display case, we should just use Shell:
+}
+
+std::string GetXWindowName(aura::RootWindow* window) {
+ char* name = NULL;
+ XFetchName(ui::GetXDisplay(), window->GetAcceleratedWidget(), &name);
+ // ASSERT_TRUE(!!name);
oshima 2013/06/14 23:10:01 I forgot to remove this as well. Removed.
+ return std::string(name);
+}
oshima 2013/06/14 23:10:01 I also moved this to anonymous namespace.
+
+#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.
+ Shell::GetInstance()->display_controller()->SwapPrimaryDisplay();
+ GetPrimaryAndSeconary(&primary, &secondary);
+ EXPECT_EQ("aura_root_0", GetXWindowName(primary));
+ EXPECT_EQ("aura_root_x", GetXWindowName(secondary));
Josh Horwich 2013/06/14 22:44:03 Would it make sense to save the pointers from befo
oshima 2013/06/14 23:10:01 Swapping display actually doesn't change the root
+
+ // Switching back to single display.
+ UpdateDisplay("300x400");
+ EXPECT_EQ("aura_root_0", GetXWindowName(Shell::GetPrimaryRootWindow()));
+}
+#endif
+
} // namespace test
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698