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

Side by Side Diff: ash/wm/shelf_layout_manager_unittest.cc

Issue 10540123: Rename gfx::Screen::GetMonitorXXXX to gfx::Screen::GetDisplayXXX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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/shelf_layout_manager.cc ('k') | ash/wm/system_gesture_event_filter.cc » ('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 (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/shelf_layout_manager.h" 5 #include "ash/wm/shelf_layout_manager.h"
6 6
7 #include "ash/focus_cycler.h" 7 #include "ash/focus_cycler.h"
8 #include "ash/launcher/launcher.h" 8 #include "ash/launcher/launcher.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 shelf->LayoutShelf(); 88 shelf->LayoutShelf();
89 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 89 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
90 90
91 gfx::Rect status_bounds(shelf->status()->GetWindowScreenBounds()); 91 gfx::Rect status_bounds(shelf->status()->GetWindowScreenBounds());
92 gfx::Rect launcher_bounds(shelf->launcher_widget()->GetWindowScreenBounds()); 92 gfx::Rect launcher_bounds(shelf->launcher_widget()->GetWindowScreenBounds());
93 int shelf_height = shelf->GetIdealBounds().height(); 93 int shelf_height = shelf->GetIdealBounds().height();
94 94
95 const aura::MonitorManager* manager = 95 const aura::MonitorManager* manager =
96 aura::Env::GetInstance()->monitor_manager(); 96 aura::Env::GetInstance()->monitor_manager();
97 const gfx::Display& display = 97 const gfx::Display& display =
98 manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); 98 manager->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
99 ASSERT_NE(-1, display.id()); 99 ASSERT_NE(-1, display.id());
100 // Bottom inset should be the max of widget heights. 100 // Bottom inset should be the max of widget heights.
101 EXPECT_EQ(shelf_height, 101 EXPECT_EQ(shelf_height,
102 display.bounds().bottom() - display.work_area().bottom()); 102 display.bounds().bottom() - display.work_area().bottom());
103 103
104 // Hide the shelf. 104 // Hide the shelf.
105 SetState(shelf, ShelfLayoutManager::HIDDEN); 105 SetState(shelf, ShelfLayoutManager::HIDDEN);
106 // Run the animation to completion. 106 // Run the animation to completion.
107 StepWidgetLayerAnimatorToEnd(shelf->launcher_widget()); 107 StepWidgetLayerAnimatorToEnd(shelf->launcher_widget());
108 StepWidgetLayerAnimatorToEnd(shelf->status()); 108 StepWidgetLayerAnimatorToEnd(shelf->status());
109 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 109 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
110 EXPECT_EQ(0, 110 EXPECT_EQ(0,
111 display.bounds().bottom() - display.work_area().bottom()); 111 display.bounds().bottom() - display.work_area().bottom());
112 112
113 // Make sure the bounds of the two widgets changed. 113 // Make sure the bounds of the two widgets changed.
114 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), 114 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(),
115 gfx::Screen::GetPrimaryMonitor().bounds().bottom()); 115 gfx::Screen::GetPrimaryDisplay().bounds().bottom());
116 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), 116 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(),
117 gfx::Screen::GetPrimaryMonitor().bounds().bottom()); 117 gfx::Screen::GetPrimaryDisplay().bounds().bottom());
118 118
119 // And show it again. 119 // And show it again.
120 SetState(shelf, ShelfLayoutManager::VISIBLE); 120 SetState(shelf, ShelfLayoutManager::VISIBLE);
121 // Run the animation to completion. 121 // Run the animation to completion.
122 StepWidgetLayerAnimatorToEnd(shelf->launcher_widget()); 122 StepWidgetLayerAnimatorToEnd(shelf->launcher_widget());
123 StepWidgetLayerAnimatorToEnd(shelf->status()); 123 StepWidgetLayerAnimatorToEnd(shelf->status());
124 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 124 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
125 EXPECT_EQ(shelf_height, 125 EXPECT_EQ(shelf_height,
126 display.bounds().bottom() - display.work_area().bottom()); 126 display.bounds().bottom() - display.work_area().bottom());
127 127
128 // Make sure the bounds of the two widgets changed. 128 // Make sure the bounds of the two widgets changed.
129 launcher_bounds = shelf->launcher_widget()->GetNativeView()->bounds(); 129 launcher_bounds = shelf->launcher_widget()->GetNativeView()->bounds();
130 int bottom = gfx::Screen::GetPrimaryMonitor().bounds().bottom() - 130 int bottom = gfx::Screen::GetPrimaryDisplay().bounds().bottom() -
131 shelf_height; 131 shelf_height;
132 EXPECT_EQ(launcher_bounds.y(), 132 EXPECT_EQ(launcher_bounds.y(),
133 bottom + (shelf->GetIdealBounds().height() - 133 bottom + (shelf->GetIdealBounds().height() -
134 launcher_bounds.height()) / 2); 134 launcher_bounds.height()) / 2);
135 status_bounds = shelf->status()->GetNativeView()->bounds(); 135 status_bounds = shelf->status()->GetNativeView()->bounds();
136 EXPECT_EQ(status_bounds.y(), 136 EXPECT_EQ(status_bounds.y(),
137 bottom + shelf_height - status_bounds.height()); 137 bottom + shelf_height - status_bounds.height());
138 } 138 }
139 139
140 // Makes sure LayoutShelf invoked while animating cleans things up. 140 // Makes sure LayoutShelf invoked while animating cleans things up.
141 TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { 141 TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) {
142 ShelfLayoutManager* shelf = GetShelfLayoutManager(); 142 ShelfLayoutManager* shelf = GetShelfLayoutManager();
143 // Force an initial layout. 143 // Force an initial layout.
144 shelf->LayoutShelf(); 144 shelf->LayoutShelf();
145 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 145 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
146 146
147 const aura::MonitorManager* manager = 147 const aura::MonitorManager* manager =
148 aura::Env::GetInstance()->monitor_manager(); 148 aura::Env::GetInstance()->monitor_manager();
149 const gfx::Display& display = 149 const gfx::Display& display =
150 manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); 150 manager->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
151 151
152 // Hide the shelf. 152 // Hide the shelf.
153 SetState(shelf, ShelfLayoutManager::HIDDEN); 153 SetState(shelf, ShelfLayoutManager::HIDDEN);
154 shelf->LayoutShelf(); 154 shelf->LayoutShelf();
155 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state()); 155 EXPECT_EQ(ShelfLayoutManager::HIDDEN, shelf->visibility_state());
156 EXPECT_EQ(0, display.bounds().bottom() - display.work_area().bottom()); 156 EXPECT_EQ(0, display.bounds().bottom() - display.work_area().bottom());
157 157
158 // Make sure the bounds of the two widgets changed. 158 // Make sure the bounds of the two widgets changed.
159 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), 159 EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(),
160 gfx::Screen::GetPrimaryMonitor().bounds().bottom()); 160 gfx::Screen::GetPrimaryDisplay().bounds().bottom());
161 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), 161 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(),
162 gfx::Screen::GetPrimaryMonitor().bounds().bottom()); 162 gfx::Screen::GetPrimaryDisplay().bounds().bottom());
163 } 163 }
164 164
165 // Makes sure the launcher is initially sized correctly. 165 // Makes sure the launcher is initially sized correctly.
166 TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) { 166 TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) {
167 Launcher* launcher = Shell::GetInstance()->launcher(); 167 Launcher* launcher = Shell::GetInstance()->launcher();
168 ASSERT_TRUE(launcher); 168 ASSERT_TRUE(launcher);
169 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); 169 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager();
170 ASSERT_TRUE(shelf_layout_manager); 170 ASSERT_TRUE(shelf_layout_manager);
171 ASSERT_TRUE(shelf_layout_manager->status()); 171 ASSERT_TRUE(shelf_layout_manager->status());
172 int status_width = 172 int status_width =
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 widget->Show(); 214 widget->Show();
215 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); 215 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
216 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); 216 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
217 217
218 // LayoutShelf() forces the animation to completion, at which point the 218 // LayoutShelf() forces the animation to completion, at which point the
219 // launcher should go off the screen. 219 // launcher should go off the screen.
220 shelf->LayoutShelf(); 220 shelf->LayoutShelf();
221 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, 221 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize,
222 shelf->launcher_widget()->GetWindowScreenBounds().y()); 222 shelf->launcher_widget()->GetWindowScreenBounds().y());
223 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, 223 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize,
224 gfx::Screen::GetMonitorNearestWindow(root).work_area().bottom()); 224 gfx::Screen::GetDisplayNearestWindow(root).work_area().bottom());
225 225
226 // Move the mouse to the bottom of the screen. 226 // Move the mouse to the bottom of the screen.
227 generator.MoveMouseTo(0, root->bounds().bottom() - 1); 227 generator.MoveMouseTo(0, root->bounds().bottom() - 1);
228 228
229 // Shelf should be shown again (but it shouldn't have changed the work area). 229 // Shelf should be shown again (but it shouldn't have changed the work area).
230 SetState(shelf, ShelfLayoutManager::AUTO_HIDE); 230 SetState(shelf, ShelfLayoutManager::AUTO_HIDE);
231 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); 231 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state());
232 shelf->LayoutShelf(); 232 shelf->LayoutShelf();
233 EXPECT_EQ(root->bounds().bottom() - shelf->GetIdealBounds().height(), 233 EXPECT_EQ(root->bounds().bottom() - shelf->GetIdealBounds().height(),
234 shelf->launcher_widget()->GetWindowScreenBounds().y()); 234 shelf->launcher_widget()->GetWindowScreenBounds().y());
235 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, 235 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize,
236 gfx::Screen::GetMonitorNearestWindow(root).work_area().bottom()); 236 gfx::Screen::GetDisplayNearestWindow(root).work_area().bottom());
237 237
238 // Move mouse back up. 238 // Move mouse back up.
239 generator.MoveMouseTo(0, 0); 239 generator.MoveMouseTo(0, 0);
240 SetState(shelf, ShelfLayoutManager::AUTO_HIDE); 240 SetState(shelf, ShelfLayoutManager::AUTO_HIDE);
241 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); 241 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
242 shelf->LayoutShelf(); 242 shelf->LayoutShelf();
243 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, 243 EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize,
244 shelf->launcher_widget()->GetWindowScreenBounds().y()); 244 shelf->launcher_widget()->GetWindowScreenBounds().y());
245 245
246 // Drag mouse to bottom of screen. 246 // Drag mouse to bottom of screen.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 ShelfLayoutManager* shelf = GetShelfLayoutManager(); 321 ShelfLayoutManager* shelf = GetShelfLayoutManager();
322 views::Widget* widget = new views::Widget; 322 views::Widget* widget = new views::Widget;
323 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 323 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
324 params.bounds = gfx::Rect(0, 0, 200, 200); 324 params.bounds = gfx::Rect(0, 0, 200, 200);
325 // Widget is now owned by the parent window. 325 // Widget is now owned by the parent window.
326 widget->Init(params); 326 widget->Init(params);
327 widget->Show(); 327 widget->Show();
328 aura::Window* window = widget->GetNativeWindow(); 328 aura::Window* window = widget->GetNativeWindow();
329 gfx::Rect monitor_bounds( 329 gfx::Rect monitor_bounds(
330 gfx::Screen::GetMonitorNearestWindow(window).bounds()); 330 gfx::Screen::GetDisplayNearestWindow(window).bounds());
331 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideSize, 331 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideSize,
332 shelf->GetMaximizedWindowBounds(window).bottom()); 332 shelf->GetMaximizedWindowBounds(window).bottom());
333 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 333 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
334 334
335 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 335 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
336 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); 336 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
337 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideSize, 337 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideSize,
338 shelf->GetMaximizedWindowBounds(window).bottom()); 338 shelf->GetMaximizedWindowBounds(window).bottom());
339 339
340 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT); 340 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT);
341 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 341 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
342 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideSize, 342 EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideSize,
343 shelf->GetMaximizedWindowBounds(window).bottom()); 343 shelf->GetMaximizedWindowBounds(window).bottom());
344 344
345 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 345 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
346 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 346 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
347 EXPECT_GT(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideSize, 347 EXPECT_GT(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideSize,
348 shelf->GetMaximizedWindowBounds(window).bottom()); 348 shelf->GetMaximizedWindowBounds(window).bottom());
349 349
350 widget->Maximize(); 350 widget->Maximize();
351 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 351 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
352 EXPECT_EQ(gfx::Screen::GetMonitorNearestWindow(window).work_area().bottom(), 352 EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(),
353 widget->GetWorkAreaBoundsInScreen().bottom()); 353 widget->GetWorkAreaBoundsInScreen().bottom());
354 354
355 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 355 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
356 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); 356 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state());
357 EXPECT_EQ(gfx::Screen::GetMonitorNearestWindow(window).work_area().bottom(), 357 EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(),
358 widget->GetWorkAreaBoundsInScreen().bottom()); 358 widget->GetWorkAreaBoundsInScreen().bottom());
359 359
360 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 360 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
361 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 361 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
362 EXPECT_EQ(gfx::Screen::GetMonitorNearestWindow(window).work_area().bottom(), 362 EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(),
363 widget->GetWorkAreaBoundsInScreen().bottom()); 363 widget->GetWorkAreaBoundsInScreen().bottom());
364 } 364 }
365 365
366 // Verifies the shelf is visible when status/launcher is focused. 366 // Verifies the shelf is visible when status/launcher is focused.
367 TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) { 367 TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrLauncherFocused) {
368 // Since ShelfLayoutManager queries for mouse location, move the mouse so 368 // Since ShelfLayoutManager queries for mouse location, move the mouse so
369 // it isn't over the shelf. 369 // it isn't over the shelf.
370 aura::test::EventGenerator generator( 370 aura::test::EventGenerator generator(
371 Shell::GetPrimaryRootWindow(), gfx::Point()); 371 Shell::GetPrimaryRootWindow(), gfx::Point());
372 generator.MoveMouseTo(0, 0); 372 generator.MoveMouseTo(0, 0);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Force an initial layout. 497 // Force an initial layout.
498 shelf->LayoutShelf(); 498 shelf->LayoutShelf();
499 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); 499 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
500 500
501 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); 501 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
502 502
503 gfx::Rect launcher_bounds(shelf->launcher_widget()->GetWindowScreenBounds()); 503 gfx::Rect launcher_bounds(shelf->launcher_widget()->GetWindowScreenBounds());
504 const aura::MonitorManager* manager = 504 const aura::MonitorManager* manager =
505 aura::Env::GetInstance()->monitor_manager(); 505 aura::Env::GetInstance()->monitor_manager();
506 gfx::Display display = 506 gfx::Display display =
507 manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); 507 manager->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
508 ASSERT_NE(-1, display.id()); 508 ASSERT_NE(-1, display.id());
509 EXPECT_EQ(shelf->GetIdealBounds().width(), 509 EXPECT_EQ(shelf->GetIdealBounds().width(),
510 display.GetWorkAreaInsets().left()); 510 display.GetWorkAreaInsets().left());
511 EXPECT_GE( 511 EXPECT_GE(
512 launcher_bounds.width(), 512 launcher_bounds.width(),
513 shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width()); 513 shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width());
514 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, 514 EXPECT_EQ(SHELF_ALIGNMENT_LEFT,
515 Shell::GetInstance()->system_tray()->shelf_alignment()); 515 Shell::GetInstance()->system_tray()->shelf_alignment());
516 gfx::Rect status_bounds(shelf->status()->GetWindowScreenBounds()); 516 gfx::Rect status_bounds(shelf->status()->GetWindowScreenBounds());
517 EXPECT_GE(status_bounds.width(), 517 EXPECT_GE(status_bounds.width(),
518 shelf->status()->GetContentsView()->GetPreferredSize().width()); 518 shelf->status()->GetContentsView()->GetPreferredSize().width());
519 EXPECT_EQ(shelf->GetIdealBounds().width(), 519 EXPECT_EQ(shelf->GetIdealBounds().width(),
520 display.GetWorkAreaInsets().left()); 520 display.GetWorkAreaInsets().left());
521 EXPECT_EQ(0, display.GetWorkAreaInsets().top()); 521 EXPECT_EQ(0, display.GetWorkAreaInsets().top());
522 EXPECT_EQ(0, display.GetWorkAreaInsets().bottom()); 522 EXPECT_EQ(0, display.GetWorkAreaInsets().bottom());
523 EXPECT_EQ(0, display.GetWorkAreaInsets().right()); 523 EXPECT_EQ(0, display.GetWorkAreaInsets().right());
524 EXPECT_EQ(display.bounds().x(), launcher_bounds.x()); 524 EXPECT_EQ(display.bounds().x(), launcher_bounds.x());
525 EXPECT_EQ(display.bounds().y(), launcher_bounds.y()); 525 EXPECT_EQ(display.bounds().y(), launcher_bounds.y());
526 EXPECT_EQ(display.bounds().height(), launcher_bounds.height()); 526 EXPECT_EQ(display.bounds().height(), launcher_bounds.height());
527 527
528 shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); 528 shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT);
529 launcher_bounds = shelf->launcher_widget()->GetWindowScreenBounds(); 529 launcher_bounds = shelf->launcher_widget()->GetWindowScreenBounds();
530 display = manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); 530 display = manager->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
531 ASSERT_NE(-1, display.id()); 531 ASSERT_NE(-1, display.id());
532 EXPECT_EQ(shelf->GetIdealBounds().width(), 532 EXPECT_EQ(shelf->GetIdealBounds().width(),
533 display.GetWorkAreaInsets().right()); 533 display.GetWorkAreaInsets().right());
534 EXPECT_GE( 534 EXPECT_GE(
535 launcher_bounds.width(), 535 launcher_bounds.width(),
536 shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width()); 536 shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width());
537 EXPECT_EQ(SHELF_ALIGNMENT_RIGHT, 537 EXPECT_EQ(SHELF_ALIGNMENT_RIGHT,
538 Shell::GetInstance()->system_tray()->shelf_alignment()); 538 Shell::GetInstance()->system_tray()->shelf_alignment());
539 status_bounds = gfx::Rect(shelf->status()->GetWindowScreenBounds()); 539 status_bounds = gfx::Rect(shelf->status()->GetWindowScreenBounds());
540 EXPECT_GE(status_bounds.width(), 540 EXPECT_GE(status_bounds.width(),
541 shelf->status()->GetContentsView()->GetPreferredSize().width()); 541 shelf->status()->GetContentsView()->GetPreferredSize().width());
542 EXPECT_EQ(shelf->GetIdealBounds().width(), 542 EXPECT_EQ(shelf->GetIdealBounds().width(),
543 display.GetWorkAreaInsets().right()); 543 display.GetWorkAreaInsets().right());
544 EXPECT_EQ(0, display.GetWorkAreaInsets().top()); 544 EXPECT_EQ(0, display.GetWorkAreaInsets().top());
545 EXPECT_EQ(0, display.GetWorkAreaInsets().bottom()); 545 EXPECT_EQ(0, display.GetWorkAreaInsets().bottom());
546 EXPECT_EQ(0, display.GetWorkAreaInsets().left()); 546 EXPECT_EQ(0, display.GetWorkAreaInsets().left());
547 EXPECT_EQ(display.work_area().right(), launcher_bounds.x()); 547 EXPECT_EQ(display.work_area().right(), launcher_bounds.x());
548 EXPECT_EQ(display.bounds().y(), launcher_bounds.y()); 548 EXPECT_EQ(display.bounds().y(), launcher_bounds.y());
549 EXPECT_EQ(display.bounds().height(), launcher_bounds.height()); 549 EXPECT_EQ(display.bounds().height(), launcher_bounds.height());
550 } 550 }
551 551
552 } // namespace internal 552 } // namespace internal
553 } // namespace ash 553 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/shelf_layout_manager.cc ('k') | ash/wm/system_gesture_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698