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

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

Issue 2194353002: mash: Migrate ScopedTargetRootWindow to //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: non-virtual Created 4 years, 4 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/wm/window_positioner_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 db3850dd5560d4454265dd764bef43f691ac9a4b..1d199f8aa7b3904ed1d7b56dc7ff3be53cc0b828 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ash/common/scoped_root_window_for_new_windows.h"
#include "ash/common/wm/window_positioner.h"
#include "ash/common/wm/window_resizer.h"
#include "ash/common/wm/window_state.h"
-#include "ash/scoped_target_root_window.h"
+#include "ash/common/wm_shell.h"
+#include "ash/common/wm_window.h"
#include "ash/screen_util.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
@@ -561,9 +563,6 @@ TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) {
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
gfx::Rect secondary_bounds = ash::ScreenUtil::GetSecondaryDisplay().bounds();
- ash::Shell::GetInstance()->set_target_root_window(
- ash::Shell::GetPrimaryRootWindow());
-
std::unique_ptr<TestingProfile> profile(new TestingProfile());
// Create browser windows that are used as reference.
@@ -821,24 +820,20 @@ TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) {
if (!SupportsMultipleDisplays() || !chrome::ShouldOpenAshOnStartup())
return;
UpdateDisplay("500x500,600x600");
+
+ // By default windows are placed on the primary display.
+ ash::WmWindow* first_root = ash::WmShell::Get()->GetAllRootWindows()[0];
+ EXPECT_EQ(first_root, ash::WmShell::Get()->GetRootWindowForNewWindows());
+ 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* first_root =
- ash::Shell::GetAllRootWindows()[0];
- ash::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::ScopedTargetRootWindow tmp(second_root);
+ // When the second display is active new windows are placed there.
+ ash::WmWindow* second_root = ash::WmShell::Get()->GetAllRootWindows()[1];
+ ash::ScopedRootWindowForNewWindows tmp(second_root);
gfx::Rect bounds;
ui::WindowShowState show_state;
WindowSizer::GetBrowserWindowBoundsAndShowState(
« no previous file with comments | « ash/wm/window_positioner_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698