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

Unified Diff: chrome/browser/ui/window_sizer/window_sizer_common_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_common_unittest.cc
diff --git a/chrome/browser/ui/window_sizer/window_sizer_common_unittest.cc b/chrome/browser/ui/window_sizer/window_sizer_common_unittest.cc
index 3c6c5ab154a9b1f7fa9ae862aa57e233c5301740..0b9126f1f5834652799069eb18438b6fc7b46ab3 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_common_unittest.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_common_unittest.cc
@@ -112,6 +112,23 @@ class TestScreen : public gfx::Screen {
DISALLOW_COPY_AND_ASSIGN(TestScreen);
};
+class TestTargetDisplayProvider : public WindowSizer::TargetDisplayProvider {
+public:
+ TestTargetDisplayProvider() {}
+ virtual ~TestTargetDisplayProvider() {}
+
+ virtual gfx::Display GetTargetDisplay(
+ const gfx::Screen* screen,
+ const gfx::Rect& bounds) const OVERRIDE {
+ // On ash, the bounds is used as a indicator to specify
+ // the target display.
+ return screen->GetDisplayMatching(bounds);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestTargetDisplayProvider);
+};
+
} // namespace
TestStateProvider::TestStateProvider():
@@ -187,8 +204,9 @@ void GetWindowBoundsAndShowState(
sp->SetPersistentState(bounds, work_area, show_state_persisted, true);
if (source == LAST_ACTIVE || source == BOTH)
sp->SetLastActiveState(bounds, show_state_last, true);
+ WindowSizer::TargetDisplayProvider* tdp = new TestTargetDisplayProvider;
- WindowSizer sizer(sp, &test_screen, browser);
+ WindowSizer sizer(sp, tdp, &test_screen, browser);
sizer.DetermineWindowBoundsAndShowState(passed_in,
out_bounds,
out_show_state);
@@ -225,8 +243,9 @@ ui::WindowShowState GetWindowShowState(
sp->SetPersistentState(bounds, work_area, show_state_persisted, true);
if (source == LAST_ACTIVE || source == BOTH)
sp->SetLastActiveState(bounds, show_state_last, true);
+ WindowSizer::TargetDisplayProvider* tdp = new TestTargetDisplayProvider;
- WindowSizer sizer(sp, &test_screen, browser);
+ WindowSizer sizer(sp, tdp, &test_screen, browser);
ui::WindowShowState out_show_state = ui::SHOW_STATE_DEFAULT;
gfx::Rect out_bounds;
@@ -238,7 +257,8 @@ ui::WindowShowState GetWindowShowState(
}
#if !defined(OS_MACOSX)
-TEST(WindowSizerTestCommon, PersistedWindowOffscreenWithNonAggressiveRepositioning) {
+TEST(WindowSizerTestCommon,
+ PersistedWindowOffscreenWithNonAggressiveRepositioning) {
{ // off the left but the minimum visibility condition is barely satisfied
// without relocaiton.
gfx::Rect initial_bounds(-470, 50, 500, 400);

Powered by Google App Engine
This is Rietveld 408576698