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

Side by Side Diff: athena/wm/window_manager_unittest.cc

Issue 599683003: [Athena, Cleanup] rename WidnowManager::GetInstance -> ::Get (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: fixed unittests Created 6 years, 2 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
« no previous file with comments | « athena/wm/window_manager_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/wm/public/window_manager.h" 5 #include "athena/wm/public/window_manager.h"
6 6
7 #include "athena/screen/public/screen_manager.h" 7 #include "athena/screen/public/screen_manager.h"
8 #include "athena/test/athena_test_base.h" 8 #include "athena/test/athena_test_base.h"
9 #include "athena/wm/public/window_list_provider.h" 9 #include "athena/wm/public/window_list_provider.h"
10 #include "athena/wm/split_view_controller.h" 10 #include "athena/wm/split_view_controller.h"
(...skipping 26 matching lines...) Expand all
37 }; 37 };
38 38
39 TEST_F(WindowManagerTest, OverviewModeBasics) { 39 TEST_F(WindowManagerTest, OverviewModeBasics) {
40 aura::test::TestWindowDelegate delegate; 40 aura::test::TestWindowDelegate delegate;
41 scoped_ptr<aura::Window> first(CreateAndShowWindow(&delegate)); 41 scoped_ptr<aura::Window> first(CreateAndShowWindow(&delegate));
42 scoped_ptr<aura::Window> second(CreateAndShowWindow(&delegate)); 42 scoped_ptr<aura::Window> second(CreateAndShowWindow(&delegate));
43 43
44 test::WindowManagerImplTestApi wm_api; 44 test::WindowManagerImplTestApi wm_api;
45 wm::ActivateWindow(second.get()); 45 wm::ActivateWindow(second.get());
46 46
47 ASSERT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive()); 47 ASSERT_FALSE(WindowManager::Get()->IsOverviewModeActive());
48 EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); 48 EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString());
49 EXPECT_EQ(gfx::Screen::GetNativeScreen() 49 EXPECT_EQ(gfx::Screen::GetNativeScreen()
50 ->GetPrimaryDisplay() 50 ->GetPrimaryDisplay()
51 .work_area() 51 .work_area()
52 .size() 52 .size()
53 .ToString(), 53 .ToString(),
54 first->bounds().size().ToString()); 54 first->bounds().size().ToString());
55 EXPECT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive()); 55 EXPECT_FALSE(WindowManager::Get()->IsOverviewModeActive());
56 56
57 // Tests that going into overview mode does not change the window bounds. 57 // Tests that going into overview mode does not change the window bounds.
58 WindowManager::GetInstance()->ToggleOverview(); 58 WindowManager::Get()->ToggleOverview();
59 ASSERT_TRUE(WindowManager::GetInstance()->IsOverviewModeActive()); 59 ASSERT_TRUE(WindowManager::Get()->IsOverviewModeActive());
60 EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString()); 60 EXPECT_EQ(first->bounds().ToString(), second->bounds().ToString());
61 EXPECT_EQ(gfx::Screen::GetNativeScreen() 61 EXPECT_EQ(gfx::Screen::GetNativeScreen()
62 ->GetPrimaryDisplay() 62 ->GetPrimaryDisplay()
63 .work_area() 63 .work_area()
64 .size() 64 .size()
65 .ToString(), 65 .ToString(),
66 first->bounds().size().ToString()); 66 first->bounds().size().ToString());
67 EXPECT_TRUE(first->IsVisible()); 67 EXPECT_TRUE(first->IsVisible());
68 EXPECT_TRUE(second->IsVisible()); 68 EXPECT_TRUE(second->IsVisible());
69 69
70 // Terminate overview mode. |first| should be hidden, since it's not visible 70 // Terminate overview mode. |first| should be hidden, since it's not visible
71 // to the user anymore. 71 // to the user anymore.
72 WindowManager::GetInstance()->ToggleOverview(); 72 WindowManager::Get()->ToggleOverview();
73 ASSERT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive()); 73 ASSERT_FALSE(WindowManager::Get()->IsOverviewModeActive());
74 EXPECT_FALSE(first->IsVisible()); 74 EXPECT_FALSE(first->IsVisible());
75 EXPECT_TRUE(second->IsVisible()); 75 EXPECT_TRUE(second->IsVisible());
76 } 76 }
77 77
78 TEST_F(WindowManagerTest, OverviewToSplitViewMode) { 78 TEST_F(WindowManagerTest, OverviewToSplitViewMode) {
79 test::WindowManagerImplTestApi wm_api; 79 test::WindowManagerImplTestApi wm_api;
80 80
81 aura::test::TestWindowDelegate delegate; 81 aura::test::TestWindowDelegate delegate;
82 scoped_ptr<aura::Window> w1(CreateAndShowWindow(&delegate)); 82 scoped_ptr<aura::Window> w1(CreateAndShowWindow(&delegate));
83 scoped_ptr<aura::Window> w2(CreateAndShowWindow(&delegate)); 83 scoped_ptr<aura::Window> w2(CreateAndShowWindow(&delegate));
84 scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate)); 84 scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate));
85 wm::ActivateWindow(w3.get()); 85 wm::ActivateWindow(w3.get());
86 86
87 WindowManager::GetInstance()->ToggleOverview(); 87 WindowManager::Get()->ToggleOverview();
88 EXPECT_TRUE(w1->IsVisible()); 88 EXPECT_TRUE(w1->IsVisible());
89 EXPECT_TRUE(w2->IsVisible()); 89 EXPECT_TRUE(w2->IsVisible());
90 EXPECT_TRUE(w3->IsVisible()); 90 EXPECT_TRUE(w3->IsVisible());
91 91
92 // Go into split-view mode. 92 // Go into split-view mode.
93 WindowOverviewModeDelegate* overview_delegate = wm_api.wm(); 93 WindowOverviewModeDelegate* overview_delegate = wm_api.wm();
94 overview_delegate->OnSelectSplitViewWindow(w3.get(), NULL, w3.get()); 94 overview_delegate->OnSelectSplitViewWindow(w3.get(), NULL, w3.get());
95 EXPECT_TRUE(w3->IsVisible()); 95 EXPECT_TRUE(w3->IsVisible());
96 EXPECT_TRUE(w2->IsVisible()); 96 EXPECT_TRUE(w2->IsVisible());
97 EXPECT_FALSE(w1->IsVisible()); 97 EXPECT_FALSE(w1->IsVisible());
98 } 98 }
99 99
100 TEST_F(WindowManagerTest, NewWindowFromOverview) { 100 TEST_F(WindowManagerTest, NewWindowFromOverview) {
101 aura::test::TestWindowDelegate delegate; 101 aura::test::TestWindowDelegate delegate;
102 scoped_ptr<aura::Window> w1(CreateAndShowWindow(&delegate)); 102 scoped_ptr<aura::Window> w1(CreateAndShowWindow(&delegate));
103 scoped_ptr<aura::Window> w2(CreateAndShowWindow(&delegate)); 103 scoped_ptr<aura::Window> w2(CreateAndShowWindow(&delegate));
104 104
105 WindowManager::GetInstance()->ToggleOverview(); 105 WindowManager::Get()->ToggleOverview();
106 EXPECT_TRUE(w1->IsVisible()); 106 EXPECT_TRUE(w1->IsVisible());
107 EXPECT_TRUE(w2->IsVisible()); 107 EXPECT_TRUE(w2->IsVisible());
108 108
109 // Test that opening a new window exits overview mode. The new window could 109 // Test that opening a new window exits overview mode. The new window could
110 // have been opened by JavaScript or by the home card. 110 // have been opened by JavaScript or by the home card.
111 scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate)); 111 scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate));
112 112
113 ASSERT_FALSE(WindowManager::GetInstance()->IsOverviewModeActive()); 113 ASSERT_FALSE(WindowManager::Get()->IsOverviewModeActive());
114 EXPECT_TRUE(w3->IsVisible()); 114 EXPECT_TRUE(w3->IsVisible());
115 EXPECT_TRUE(wm::IsActiveWindow(w3.get())); 115 EXPECT_TRUE(wm::IsActiveWindow(w3.get()));
116 EXPECT_FALSE(w1->IsVisible()); 116 EXPECT_FALSE(w1->IsVisible());
117 EXPECT_FALSE(w2->IsVisible()); 117 EXPECT_FALSE(w2->IsVisible());
118 } 118 }
119 119
120 TEST_F(WindowManagerTest, BezelGestureToSplitViewMode) { 120 TEST_F(WindowManagerTest, BezelGestureToSplitViewMode) {
121 aura::test::TestWindowDelegate delegate; 121 aura::test::TestWindowDelegate delegate;
122 scoped_ptr<aura::Window> first(CreateAndShowWindow(&delegate)); 122 scoped_ptr<aura::Window> first(CreateAndShowWindow(&delegate));
123 scoped_ptr<aura::Window> second(CreateAndShowWindow(&delegate)); 123 scoped_ptr<aura::Window> second(CreateAndShowWindow(&delegate));
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 TEST_F(WindowManagerTest, OverviewModeFromSplitMode) { 333 TEST_F(WindowManagerTest, OverviewModeFromSplitMode) {
334 test::WindowManagerImplTestApi wm_api; 334 test::WindowManagerImplTestApi wm_api;
335 335
336 aura::test::TestWindowDelegate delegate; 336 aura::test::TestWindowDelegate delegate;
337 scoped_ptr<aura::Window> w1(CreateAndShowWindow(&delegate)); 337 scoped_ptr<aura::Window> w1(CreateAndShowWindow(&delegate));
338 scoped_ptr<aura::Window> w2(CreateAndShowWindow(&delegate)); 338 scoped_ptr<aura::Window> w2(CreateAndShowWindow(&delegate));
339 scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate)); 339 scoped_ptr<aura::Window> w3(CreateAndShowWindow(&delegate));
340 340
341 // Get into split-view mode, and then turn on overview mode. 341 // Get into split-view mode, and then turn on overview mode.
342 wm_api.GetSplitViewController()->ActivateSplitMode(NULL, NULL); 342 wm_api.GetSplitViewController()->ActivateSplitMode(NULL, NULL);
343 WindowManager::GetInstance()->ToggleOverview(); 343 WindowManager::Get()->ToggleOverview();
344 EXPECT_TRUE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); 344 EXPECT_TRUE(wm_api.GetSplitViewController()->IsSplitViewModeActive());
345 EXPECT_EQ(w3.get(), wm_api.GetSplitViewController()->left_window()); 345 EXPECT_EQ(w3.get(), wm_api.GetSplitViewController()->left_window());
346 EXPECT_EQ(w2.get(), wm_api.GetSplitViewController()->right_window()); 346 EXPECT_EQ(w2.get(), wm_api.GetSplitViewController()->right_window());
347 347
348 WindowOverviewModeDelegate* overview_delegate = wm_api.wm(); 348 WindowOverviewModeDelegate* overview_delegate = wm_api.wm();
349 overview_delegate->OnSelectWindow(w1.get()); 349 overview_delegate->OnSelectWindow(w1.get());
350 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive()); 350 EXPECT_FALSE(wm_api.GetSplitViewController()->IsSplitViewModeActive());
351 EXPECT_TRUE(w1->IsVisible()); 351 EXPECT_TRUE(w1->IsVisible());
352 // Make sure the windows that were in split-view mode are hidden. 352 // Make sure the windows that were in split-view mode are hidden.
353 EXPECT_FALSE(w2->IsVisible()); 353 EXPECT_FALSE(w2->IsVisible());
354 EXPECT_FALSE(w3->IsVisible()); 354 EXPECT_FALSE(w3->IsVisible());
355 } 355 }
356 356
357 } // namespace athena 357 } // namespace athena
OLDNEW
« no previous file with comments | « athena/wm/window_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698