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

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

Issue 224113005: Eliminate ash::internal namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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/display/display_layout.h" 7 #include "ash/display/display_layout.h"
8 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 364 }
365 365
366 // Verifies a window created with maximized state has the maximized 366 // Verifies a window created with maximized state has the maximized
367 // bounds. 367 // bounds.
368 TEST_F(WorkspaceLayoutManagerTest, MaximizeWithEmptySize) { 368 TEST_F(WorkspaceLayoutManagerTest, MaximizeWithEmptySize) {
369 scoped_ptr<aura::Window> window( 369 scoped_ptr<aura::Window> window(
370 aura::test::CreateTestWindowWithBounds(gfx::Rect(0, 0, 0, 0), 370 aura::test::CreateTestWindowWithBounds(gfx::Rect(0, 0, 0, 0),
371 NULL)); 371 NULL));
372 wm::GetWindowState(window.get())->Maximize(); 372 wm::GetWindowState(window.get())->Maximize();
373 aura::Window* default_container = Shell::GetContainer( 373 aura::Window* default_container = Shell::GetContainer(
374 Shell::GetPrimaryRootWindow(), 374 Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer);
375 internal::kShellWindowId_DefaultContainer);
376 default_container->AddChild(window.get()); 375 default_container->AddChild(window.get());
377 window->Show(); 376 window->Show();
378 gfx::Rect work_area( 377 gfx::Rect work_area(
379 Shell::GetScreen()->GetPrimaryDisplay().work_area()); 378 Shell::GetScreen()->GetPrimaryDisplay().work_area());
380 EXPECT_EQ(work_area.ToString(), window->GetBoundsInScreen().ToString()); 379 EXPECT_EQ(work_area.ToString(), window->GetBoundsInScreen().ToString());
381 } 380 }
382 381
383 TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) { 382 TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) {
384 // Normal window bounds shouldn't be changed. 383 // Normal window bounds shouldn't be changed.
385 gfx::Rect window_bounds(100, 100, 200, 200); 384 gfx::Rect window_bounds(100, 100, 200, 200);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 510
512 class WorkspaceLayoutManagerSoloTest : public test::AshTestBase { 511 class WorkspaceLayoutManagerSoloTest : public test::AshTestBase {
513 public: 512 public:
514 WorkspaceLayoutManagerSoloTest() {} 513 WorkspaceLayoutManagerSoloTest() {}
515 virtual ~WorkspaceLayoutManagerSoloTest() {} 514 virtual ~WorkspaceLayoutManagerSoloTest() {}
516 515
517 virtual void SetUp() OVERRIDE { 516 virtual void SetUp() OVERRIDE {
518 test::AshTestBase::SetUp(); 517 test::AshTestBase::SetUp();
519 UpdateDisplay("800x600"); 518 UpdateDisplay("800x600");
520 aura::Window* default_container = Shell::GetContainer( 519 aura::Window* default_container = Shell::GetContainer(
521 Shell::GetPrimaryRootWindow(), 520 Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer);
522 internal::kShellWindowId_DefaultContainer); 521 default_container->SetLayoutManager(
523 default_container->SetLayoutManager(new internal::WorkspaceLayoutManager( 522 new WorkspaceLayoutManager(Shell::GetPrimaryRootWindow()));
524 Shell::GetPrimaryRootWindow()));
525 } 523 }
526 524
527 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { 525 aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
528 return CreateTestWindowInShellWithBounds(bounds); 526 return CreateTestWindowInShellWithBounds(bounds);
529 } 527 }
530 528
531 private: 529 private:
532 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerSoloTest); 530 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerSoloTest);
533 }; 531 };
534 532
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 } 745 }
748 746
749 // Verify if the window is not resized during screen lock. See: crbug.com/173127 747 // Verify if the window is not resized during screen lock. See: crbug.com/173127
750 TEST_F(WorkspaceLayoutManagerSoloTest, NotResizeWhenScreenIsLocked) { 748 TEST_F(WorkspaceLayoutManagerSoloTest, NotResizeWhenScreenIsLocked) {
751 SetCanLockScreen(true); 749 SetCanLockScreen(true);
752 scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(1, 2, 3, 4))); 750 scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(1, 2, 3, 4)));
753 // window with AlwaysOnTop will be managed by BaseLayoutManager. 751 // window with AlwaysOnTop will be managed by BaseLayoutManager.
754 window->SetProperty(aura::client::kAlwaysOnTopKey, true); 752 window->SetProperty(aura::client::kAlwaysOnTopKey, true);
755 window->Show(); 753 window->Show();
756 754
757 internal::ShelfLayoutManager* shelf = 755 ShelfLayoutManager* shelf = ShelfLayoutManager::ForShelf(window.get());
758 internal::ShelfLayoutManager::ForShelf(window.get());
759 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 756 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
760 757
761 window->SetBounds(ScreenUtil::GetMaximizedWindowBoundsInParent(window.get())); 758 window->SetBounds(ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()));
762 gfx::Rect window_bounds = window->bounds(); 759 gfx::Rect window_bounds = window->bounds();
763 EXPECT_EQ( 760 EXPECT_EQ(
764 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(), 761 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
765 window_bounds.ToString()); 762 window_bounds.ToString());
766 763
767 Shell::GetInstance()->session_state_delegate()->LockScreen(); 764 Shell::GetInstance()->session_state_delegate()->LockScreen();
768 shelf->UpdateVisibilityState(); 765 shelf->UpdateVisibilityState();
(...skipping 11 matching lines...) Expand all
780 namespace { 777 namespace {
781 778
782 class WorkspaceLayoutManagerBackdropTest : public test::AshTestBase { 779 class WorkspaceLayoutManagerBackdropTest : public test::AshTestBase {
783 public: 780 public:
784 WorkspaceLayoutManagerBackdropTest() {} 781 WorkspaceLayoutManagerBackdropTest() {}
785 virtual ~WorkspaceLayoutManagerBackdropTest() {} 782 virtual ~WorkspaceLayoutManagerBackdropTest() {}
786 783
787 virtual void SetUp() OVERRIDE { 784 virtual void SetUp() OVERRIDE {
788 test::AshTestBase::SetUp(); 785 test::AshTestBase::SetUp();
789 UpdateDisplay("800x600"); 786 UpdateDisplay("800x600");
790 default_container_ = Shell::GetContainer( 787 default_container_ = Shell::GetContainer(Shell::GetPrimaryRootWindow(),
791 Shell::GetPrimaryRootWindow(), 788 kShellWindowId_DefaultContainer);
792 internal::kShellWindowId_DefaultContainer);
793 // We set the size to something smaller then the display to avoid resizing 789 // We set the size to something smaller then the display to avoid resizing
794 // issues with the shelf. 790 // issues with the shelf.
795 default_container_->SetBounds(gfx::Rect(0, 0, 800, 500)); 791 default_container_->SetBounds(gfx::Rect(0, 0, 800, 500));
796 } 792 }
797 793
798 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { 794 aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
799 aura::Window* window = CreateTestWindowInShellWithBounds(bounds); 795 aura::Window* window = CreateTestWindowInShellWithBounds(bounds);
800 return window; 796 return window;
801 } 797 }
802 798
803 // Turn the top window back drop on / off. 799 // Turn the top window back drop on / off.
804 void ShowTopWindowBackdrop(bool show) { 800 void ShowTopWindowBackdrop(bool show) {
805 scoped_ptr<ash::internal::WorkspaceLayoutManagerDelegate> backdrop; 801 scoped_ptr<ash::WorkspaceLayoutManagerDelegate> backdrop;
806 if (show) { 802 if (show) {
807 backdrop.reset(new ash::internal::WorkspaceBackdropDelegate( 803 backdrop.reset(new ash::WorkspaceBackdropDelegate(default_container_));
808 default_container_));
809 } 804 }
810 (static_cast<internal::WorkspaceLayoutManager*> 805 (static_cast<WorkspaceLayoutManager*>(default_container_->layout_manager()))
811 (default_container_->layout_manager()))->SetMaximizeBackdropDelegate( 806 ->SetMaximizeBackdropDelegate(backdrop.Pass());
812 backdrop.Pass());
813 // Closing and / or opening can be a delayed operation. 807 // Closing and / or opening can be a delayed operation.
814 base::MessageLoop::current()->RunUntilIdle(); 808 base::MessageLoop::current()->RunUntilIdle();
815 } 809 }
816 810
817 // Return the default container. 811 // Return the default container.
818 aura::Window* default_container() { return default_container_; } 812 aura::Window* default_container() { return default_container_; }
819 813
820 // Return the order of windows (top most first) as they are in the default 814 // Return the order of windows (top most first) as they are in the default
821 // container. If the window is visible it will be a big letter, otherwise a 815 // container. If the window is visible it will be a big letter, otherwise a
822 // small one. The backdrop will be an X and unknown windows will be shown as 816 // small one. The backdrop will be an X and unknown windows will be shown as
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 EXPECT_EQ("b,x", 934 EXPECT_EQ("b,x",
941 GetWindowOrderAsString(backdrop, window1.get(), window2.get(), 935 GetWindowOrderAsString(backdrop, window1.get(), window2.get(),
942 window3.get())); 936 window3.get()));
943 ShowTopWindowBackdrop(false); 937 ShowTopWindowBackdrop(false);
944 EXPECT_EQ("b", 938 EXPECT_EQ("b",
945 GetWindowOrderAsString(NULL, window1.get(), window2.get(), 939 GetWindowOrderAsString(NULL, window1.get(), window2.get(),
946 window3.get())); 940 window3.get()));
947 } 941 }
948 942
949 } // namespace ash 943 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager_delegate.h ('k') | ash/wm/workspace/workspace_window_resizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698