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

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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 display_controller->SetLayoutForDisplayId( 244 display_controller->SetLayoutForDisplayId(
244 secondary_display.id(), secondary_layout); 245 secondary_display.id(), secondary_layout);
245 246
246 EXPECT_NE(primary_display.id(), secondary_display.id()); 247 EXPECT_NE(primary_display.id(), secondary_display.id());
247 aura::RootWindow* primary_root = 248 aura::RootWindow* primary_root =
248 display_controller->GetRootWindowForDisplayId(primary_display.id()); 249 display_controller->GetRootWindowForDisplayId(primary_display.id());
249 aura::RootWindow* secondary_root = 250 aura::RootWindow* secondary_root =
250 display_controller->GetRootWindowForDisplayId(secondary_display.id()); 251 display_controller->GetRootWindowForDisplayId(secondary_display.id());
251 EXPECT_NE(primary_root, secondary_root); 252 EXPECT_NE(primary_root, secondary_root);
252 aura::Window* launcher_window = 253 aura::Window* launcher_window =
253 Launcher::ForPrimaryDisplay()->widget()->GetNativeView(); 254 Launcher::ForPrimaryDisplay()->shelf_widget()->GetNativeView();
254 EXPECT_TRUE(primary_root->Contains(launcher_window)); 255 EXPECT_TRUE(primary_root->Contains(launcher_window));
255 EXPECT_FALSE(secondary_root->Contains(launcher_window)); 256 EXPECT_FALSE(secondary_root->Contains(launcher_window));
256 EXPECT_EQ(primary_display.id(), 257 EXPECT_EQ(primary_display.id(),
257 Shell::GetScreen()->GetDisplayNearestPoint( 258 Shell::GetScreen()->GetDisplayNearestPoint(
258 gfx::Point(-100, -100)).id()); 259 gfx::Point(-100, -100)).id());
259 EXPECT_EQ(primary_display.id(), 260 EXPECT_EQ(primary_display.id(),
260 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); 261 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
261 262
262 EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString()); 263 EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString());
263 EXPECT_EQ("0,0 200x152", primary_display.work_area().ToString()); 264 EXPECT_EQ("0,0 200x152", primary_display.work_area().ToString());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 DisplayLayout secondary_layout(DisplayLayout::RIGHT, 50); 335 DisplayLayout secondary_layout(DisplayLayout::RIGHT, 50);
335 display_controller->SetLayoutForDisplayId( 336 display_controller->SetLayoutForDisplayId(
336 secondary_display.id(), secondary_layout); 337 secondary_display.id(), secondary_layout);
337 338
338 EXPECT_NE(primary_display.id(), secondary_display.id()); 339 EXPECT_NE(primary_display.id(), secondary_display.id());
339 aura::RootWindow* primary_root = 340 aura::RootWindow* primary_root =
340 display_controller->GetRootWindowForDisplayId(primary_display.id()); 341 display_controller->GetRootWindowForDisplayId(primary_display.id());
341 aura::RootWindow* secondary_root = 342 aura::RootWindow* secondary_root =
342 display_controller->GetRootWindowForDisplayId(secondary_display.id()); 343 display_controller->GetRootWindowForDisplayId(secondary_display.id());
343 aura::Window* launcher_window = 344 aura::Window* launcher_window =
344 Launcher::ForPrimaryDisplay()->widget()->GetNativeView(); 345 Launcher::ForPrimaryDisplay()->shelf_widget()->GetNativeView();
345 EXPECT_TRUE(primary_root->Contains(launcher_window)); 346 EXPECT_TRUE(primary_root->Contains(launcher_window));
346 EXPECT_FALSE(secondary_root->Contains(launcher_window)); 347 EXPECT_FALSE(secondary_root->Contains(launcher_window));
347 EXPECT_NE(primary_root, secondary_root); 348 EXPECT_NE(primary_root, secondary_root);
348 EXPECT_EQ(primary_display.id(), 349 EXPECT_EQ(primary_display.id(),
349 Shell::GetScreen()->GetDisplayNearestPoint( 350 Shell::GetScreen()->GetDisplayNearestPoint(
350 gfx::Point(-100, -100)).id()); 351 gfx::Point(-100, -100)).id());
351 EXPECT_EQ(primary_display.id(), 352 EXPECT_EQ(primary_display.id(),
352 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); 353 Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
353 354
354 // Switch primary and secondary by display ID. 355 // Switch primary and secondary by display ID.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 UpdateDisplay("100+200-100x200,300+500-200x300"); 533 UpdateDisplay("100+200-100x200,300+500-200x300");
533 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 534 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
534 EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString()); 535 EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString());
535 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); 536 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString());
536 EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString()); 537 EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString());
537 EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString()); 538 EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString());
538 } 539 }
539 540
540 } // namespace test 541 } // namespace test
541 } // namespace ash 542 } // namespace ash
OLDNEW
« no previous file with comments | « ash/dip_unittest.cc ('k') | ash/focus_cycler_unittest.cc » ('j') | ash/launcher/launcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698