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

Side by Side Diff: ash/display/display_controller_unittest.cc

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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
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/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.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/shelf/shelf_widget.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
12 #include "ash/test/cursor_manager_test_api.h" 13 #include "ash/test/cursor_manager_test_api.h"
13 #include "ui/aura/env.h" 14 #include "ui/aura/env.h"
14 #include "ui/aura/root_window.h" 15 #include "ui/aura/root_window.h"
15 #include "ui/aura/window_tracker.h" 16 #include "ui/aura/window_tracker.h"
16 #include "ui/gfx/display.h" 17 #include "ui/gfx/display.h"
17 #include "ui/gfx/screen.h" 18 #include "ui/gfx/screen.h"
18 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
19 20
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 DisplayLayout display_layout(DisplayLayout::RIGHT, 50); 243 DisplayLayout display_layout(DisplayLayout::RIGHT, 50);
243 display_controller->SetLayoutForCurrentDisplays(display_layout); 244 display_controller->SetLayoutForCurrentDisplays(display_layout);
244 245
245 EXPECT_NE(primary_display.id(), secondary_display.id()); 246 EXPECT_NE(primary_display.id(), secondary_display.id());
246 aura::RootWindow* primary_root = 247 aura::RootWindow* primary_root =
247 display_controller->GetRootWindowForDisplayId(primary_display.id()); 248 display_controller->GetRootWindowForDisplayId(primary_display.id());
248 aura::RootWindow* secondary_root = 249 aura::RootWindow* secondary_root =
249 display_controller->GetRootWindowForDisplayId(secondary_display.id()); 250 display_controller->GetRootWindowForDisplayId(secondary_display.id());
250 EXPECT_NE(primary_root, secondary_root); 251 EXPECT_NE(primary_root, secondary_root);
251 aura::Window* launcher_window = 252 aura::Window* launcher_window =
252 Launcher::ForPrimaryDisplay()->widget()->GetNativeView(); 253 Launcher::ForPrimaryDisplay()->shelf_widget()->GetNativeView();
253 EXPECT_TRUE(primary_root->Contains(launcher_window)); 254 EXPECT_TRUE(primary_root->Contains(launcher_window));
254 EXPECT_FALSE(secondary_root->Contains(launcher_window)); 255 EXPECT_FALSE(secondary_root->Contains(launcher_window));
255 EXPECT_EQ(primary_display.id(), 256 EXPECT_EQ(primary_display.id(),
256 Shell::GetScreen()->GetDisplayNearestPoint( 257 Shell::GetScreen()->GetDisplayNearestPoint(
257 gfx::Point(-100, -100)).id()); 258 gfx::Point(-100, -100)).id());
258 EXPECT_EQ(primary_display.id(), 259 EXPECT_EQ(primary_display.id(),
259 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); 260 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
260 261
261 EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString()); 262 EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString());
262 EXPECT_EQ("0,0 200x152", primary_display.work_area().ToString()); 263 EXPECT_EQ("0,0 200x152", primary_display.work_area().ToString());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 334
334 DisplayLayout display_layout(DisplayLayout::RIGHT, 50); 335 DisplayLayout display_layout(DisplayLayout::RIGHT, 50);
335 display_controller->SetLayoutForCurrentDisplays(display_layout); 336 display_controller->SetLayoutForCurrentDisplays(display_layout);
336 337
337 EXPECT_NE(primary_display.id(), secondary_display.id()); 338 EXPECT_NE(primary_display.id(), secondary_display.id());
338 aura::RootWindow* primary_root = 339 aura::RootWindow* primary_root =
339 display_controller->GetRootWindowForDisplayId(primary_display.id()); 340 display_controller->GetRootWindowForDisplayId(primary_display.id());
340 aura::RootWindow* secondary_root = 341 aura::RootWindow* secondary_root =
341 display_controller->GetRootWindowForDisplayId(secondary_display.id()); 342 display_controller->GetRootWindowForDisplayId(secondary_display.id());
342 aura::Window* launcher_window = 343 aura::Window* launcher_window =
343 Launcher::ForPrimaryDisplay()->widget()->GetNativeView(); 344 Launcher::ForPrimaryDisplay()->shelf_widget()->GetNativeView();
344 EXPECT_TRUE(primary_root->Contains(launcher_window)); 345 EXPECT_TRUE(primary_root->Contains(launcher_window));
345 EXPECT_FALSE(secondary_root->Contains(launcher_window)); 346 EXPECT_FALSE(secondary_root->Contains(launcher_window));
346 EXPECT_NE(primary_root, secondary_root); 347 EXPECT_NE(primary_root, secondary_root);
347 EXPECT_EQ(primary_display.id(), 348 EXPECT_EQ(primary_display.id(),
348 Shell::GetScreen()->GetDisplayNearestPoint( 349 Shell::GetScreen()->GetDisplayNearestPoint(
349 gfx::Point(-100, -100)).id()); 350 gfx::Point(-100, -100)).id());
350 EXPECT_EQ(primary_display.id(), 351 EXPECT_EQ(primary_display.id(),
351 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); 352 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
352 353
353 // Switch primary and secondary by display ID. 354 // Switch primary and secondary by display ID.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 UpdateDisplay("100+200-100x200,300+500-200x300"); 532 UpdateDisplay("100+200-100x200,300+500-200x300");
532 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 533 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
533 EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString()); 534 EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString());
534 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); 535 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString());
535 EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString()); 536 EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString());
536 EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString()); 537 EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString());
537 } 538 }
538 539
539 } // namespace test 540 } // namespace test
540 } // namespace ash 541 } // namespace ash
OLDNEW
« no previous file with comments | « ash/dip_unittest.cc ('k') | ash/focus_cycler_unittest.cc » ('j') | ash/focus_cycler_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698