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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager_unittest.cc

Issue 22793011: ash:Shelf - Enable Alternate Shelf and Side Shelf by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/wm/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include "ash/ash_switches.h"
7 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
8 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
9 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_widget.h" 11 #include "ash/shelf/shelf_widget.h"
11 #include "ash/shell.h" 12 #include "ash/shell.h"
12 #include "ash/test/ash_test_base.h" 13 #include "ash/test/ash_test_base.h"
13 #include "ash/wm/property_util.h" 14 #include "ash/wm/property_util.h"
14 #include "ash/wm/window_util.h" 15 #include "ash/wm/window_util.h"
16 #include "base/command_line.h"
James Cook 2013/08/22 00:19:12 Is this needed?
Harry McCleave 2013/08/27 00:37:00 Done.
15 #include "ui/aura/client/aura_constants.h" 17 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
17 #include "ui/aura/test/test_windows.h" 19 #include "ui/aura/test/test_windows.h"
18 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
19 #include "ui/gfx/insets.h" 21 #include "ui/gfx/insets.h"
20 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
21 #include "ui/views/widget/widget_delegate.h" 23 #include "ui/views/widget/widget_delegate.h"
22 24
23 namespace ash { 25 namespace ash {
24 namespace { 26 namespace {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 133
132 scoped_ptr<aura::Window> window( 134 scoped_ptr<aura::Window> window(
133 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40))); 135 CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 30, 40)));
134 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 136 EXPECT_EQ(root_windows[0], window->GetRootWindow());
135 137
136 SetRestoreBoundsInScreen(window.get(), gfx::Rect(400, 0, 30, 40)); 138 SetRestoreBoundsInScreen(window.get(), gfx::Rect(400, 0, 30, 40));
137 // Maximize the window in 2nd display as the restore bounds 139 // Maximize the window in 2nd display as the restore bounds
138 // is inside 2nd display. 140 // is inside 2nd display.
139 wm::MaximizeWindow(window.get()); 141 wm::MaximizeWindow(window.get());
140 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 142 EXPECT_EQ(root_windows[1], window->GetRootWindow());
141 EXPECT_EQ("300,0 400x452", window->GetBoundsInScreen().ToString()); 143 EXPECT_EQ("300,0 400x453", window->GetBoundsInScreen().ToString());
142 144
143 wm::RestoreWindow(window.get()); 145 wm::RestoreWindow(window.get());
144 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 146 EXPECT_EQ(root_windows[1], window->GetRootWindow());
145 EXPECT_EQ("400,0 30x40", window->GetBoundsInScreen().ToString()); 147 EXPECT_EQ("400,0 30x40", window->GetBoundsInScreen().ToString());
146 148
147 // If the restore bounds intersects with the current display, 149 // If the restore bounds intersects with the current display,
148 // don't move. 150 // don't move.
149 SetRestoreBoundsInScreen(window.get(), gfx::Rect(280, 0, 30, 40)); 151 SetRestoreBoundsInScreen(window.get(), gfx::Rect(280, 0, 30, 40));
150 wm::MaximizeWindow(window.get()); 152 wm::MaximizeWindow(window.get());
151 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 153 EXPECT_EQ(root_windows[1], window->GetRootWindow());
152 EXPECT_EQ("300,0 400x452", window->GetBoundsInScreen().ToString()); 154 EXPECT_EQ("300,0 400x453", window->GetBoundsInScreen().ToString());
153 155
154 wm::RestoreWindow(window.get()); 156 wm::RestoreWindow(window.get());
155 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 157 EXPECT_EQ(root_windows[1], window->GetRootWindow());
156 EXPECT_EQ("280,0 30x40", window->GetBoundsInScreen().ToString()); 158 EXPECT_EQ("280,0 30x40", window->GetBoundsInScreen().ToString());
157 159
158 // Restoring widget state. 160 // Restoring widget state.
159 scoped_ptr<views::Widget> w1(new views::Widget); 161 scoped_ptr<views::Widget> w1(new views::Widget);
160 views::Widget::InitParams params; 162 views::Widget::InitParams params;
161 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 163 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
162 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40)); 164 params.delegate = new MaximizeDelegateView(gfx::Rect(400, 0, 30, 40));
163 params.context = root_windows[0]; 165 params.context = root_windows[0];
164 w1->Init(params); 166 w1->Init(params);
165 w1->Show(); 167 w1->Show();
166 EXPECT_TRUE(w1->IsMaximized()); 168 EXPECT_TRUE(w1->IsMaximized());
167 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); 169 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
168 EXPECT_EQ("300,0 400x452", w1->GetWindowBoundsInScreen().ToString()); 170 EXPECT_EQ("300,0 400x453", w1->GetWindowBoundsInScreen().ToString());
169 w1->Restore(); 171 w1->Restore();
170 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); 172 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
171 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString()); 173 EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString());
172 } 174 }
173 175
174 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) { 176 TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) {
175 if (!SupportsMultipleDisplays()) 177 if (!SupportsMultipleDisplays())
176 return; 178 return;
177 UpdateDisplay("300x400,400x500"); 179 UpdateDisplay("300x400,400x500");
178 180
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 window->bounds().ToString()); 355 window->bounds().ToString());
354 356
355 // Directly setting the bounds triggers a slightly different code path. Verify 357 // Directly setting the bounds triggers a slightly different code path. Verify
356 // that too. 358 // that too.
357 window->SetBounds(window_bounds); 359 window->SetBounds(window_bounds);
358 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), 360 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(),
359 window->bounds().ToString()); 361 window->bounds().ToString());
360 } 362 }
361 363
362 } // namespace ash 364 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698