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

Unified Diff: chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc

Issue 102773002: Open non browser window on the target display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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: chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
index 4539bafcee8b3f197843df3d7fae0fa0a8d38059..d13bb0173dd0f0dfecf4d43d346eccf34f4ec972 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ash/scoped_target_root_window.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
@@ -855,3 +856,43 @@ TEST_F(WindowSizerAshTest, TestShowStateDefaults) {
browser_popup->browser(),
p1600x1200), ui::SHOW_STATE_NORMAL);
}
+
+// Test that the target root window is used as the destionation of
+// the non browser window. This differ from PersistedBoundsCase
+// in that this uses real ash shell implementations + StateProvider
+// TargetDisplayProvider, rather than mocks.
+TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) {
+ if (!SupportsMultipleDisplays())
+ return;
+ UpdateDisplay("500x500,600x600");
+ {
+ aura::Window* first_root =
+ ash::Shell::GetAllRootWindows()[0];
+ ash::internal::ScopedTargetRootWindow tmp(
+ first_root);
+ gfx::Rect bounds;
+ ui::WindowShowState show_state;
+ WindowSizer::GetBrowserWindowBoundsAndShowState(
+ std::string(),
+ gfx::Rect(),
+ NULL,
+ &bounds,
+ &show_state);
+ EXPECT_TRUE(first_root->GetBoundsInScreen().Contains(bounds));
+ }
+ {
+ aura::Window* second_root =
+ ash::Shell::GetAllRootWindows()[1];
+ ash::internal::ScopedTargetRootWindow tmp(
+ second_root);
+ gfx::Rect bounds;
+ ui::WindowShowState show_state;
+ WindowSizer::GetBrowserWindowBoundsAndShowState(
+ std::string(),
+ gfx::Rect(),
+ NULL,
+ &bounds,
+ &show_state);
+ EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698