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

Side by Side Diff: ash/wm/overview/window_selector_unittest.cc

Issue 256413004: Relayout windows in overview when display size changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge and remove extra newline. Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/overview/window_selector_item.cc ('k') | ash/wm/overview/window_selector_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/drag_drop/drag_drop_controller.h" 5 #include "ash/drag_drop/drag_drop_controller.h"
6 #include "ash/root_window_controller.h" 6 #include "ash/root_window_controller.h"
7 #include "ash/screen_util.h" 7 #include "ash/screen_util.h"
8 #include "ash/shelf/shelf.h" 8 #include "ash/shelf/shelf.h"
9 #include "ash/shelf/shelf_widget.h" 9 #include "ash/shelf/shelf_widget.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 ToggleOverview(); 1137 ToggleOverview();
1138 WindowSelectorItem* window_item = GetWindowItems()->back(); 1138 WindowSelectorItem* window_item = GetWindowItems()->back();
1139 views::Widget* widget = GetLabelWidget(window_item); 1139 views::Widget* widget = GetLabelWidget(window_item);
1140 // Has the label widget been created? 1140 // Has the label widget been created?
1141 ASSERT_TRUE(widget); 1141 ASSERT_TRUE(widget);
1142 views::Label* label = static_cast<views::Label*>(widget->GetContentsView()); 1142 views::Label* label = static_cast<views::Label*>(widget->GetContentsView());
1143 // Verify the label matches the active window title. 1143 // Verify the label matches the active window title.
1144 EXPECT_EQ(label->text(), panel1_title); 1144 EXPECT_EQ(label->text(), panel1_title);
1145 } 1145 }
1146 1146
1147 // Tests that overview updates the window postions if the display orientation
1148 // changes.
1149 TEST_F(WindowSelectorTest, DisplayOrientationChanged) {
1150 if (!SupportsHostWindowResize())
1151 return;
1152
1153 aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow();
1154 UpdateDisplay("600x200");
1155 EXPECT_EQ("0,0 600x200", root_window->bounds().ToString());
1156 gfx::Rect window_bounds(0, 0, 150, 150);
1157 ScopedVector<aura::Window> windows;
1158 for (int i = 0; i < 3; i++) {
1159 windows.push_back(CreateWindow(window_bounds));
1160 }
1161
1162 ToggleOverview();
1163 for (ScopedVector<aura::Window>::iterator iter = windows.begin();
1164 iter != windows.end(); ++iter) {
1165 EXPECT_TRUE(root_window->bounds().Contains(
1166 ToEnclosingRect(GetTransformedTargetBounds(*iter))));
1167 }
1168
1169 // Rotate the display, windows should be repositioned to be within the screen
1170 // bounds.
1171 UpdateDisplay("600x200/r");
1172 EXPECT_EQ("0,0 200x600", root_window->bounds().ToString());
1173 for (ScopedVector<aura::Window>::iterator iter = windows.begin();
1174 iter != windows.end(); ++iter) {
1175 EXPECT_TRUE(root_window->bounds().Contains(
1176 ToEnclosingRect(GetTransformedTargetBounds(*iter))));
1177 }
1178 }
1179
1147 } // namespace ash 1180 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector_item.cc ('k') | ash/wm/overview/window_selector_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698