OLD | NEW |
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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 1289 EXPECT_TRUE(shell->GetAppListTargetVisibility()); |
1290 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 1290 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1291 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); | 1291 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); |
1292 | 1292 |
1293 // Toggle app list to hide. | 1293 // Toggle app list to hide. |
1294 shell->ToggleAppList(NULL); | 1294 shell->ToggleAppList(NULL); |
1295 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 1295 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
1296 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 1296 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1297 } | 1297 } |
1298 | 1298 |
1299 // Makes sure shelf will be hidden when app list opens as shelf is in HIDDEN | 1299 // Toggling the app list removes activation from the fullscreen window and so |
1300 // state, and toggling app list won't change shelf visibility state. | 1300 // the shelf should be visible while the app list is shown. |
1301 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) { | 1301 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) { |
1302 Shell* shell = Shell::GetInstance(); | 1302 Shell* shell = Shell::GetInstance(); |
1303 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 1303 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
1304 // For shelf to be visible, app list is not open in initial state. | 1304 // For shelf to be visible, app list is not open in initial state. |
1305 shelf->LayoutShelf(); | 1305 shelf->LayoutShelf(); |
1306 | 1306 |
1307 // Create a window and make it full screen. | 1307 // Create a window and make it full screen. |
1308 aura::Window* window = CreateTestWindow(); | 1308 aura::Window* window = CreateTestWindow(); |
1309 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1309 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
1310 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 1310 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
1311 window->Show(); | 1311 window->Show(); |
1312 wm::ActivateWindow(window); | 1312 wm::ActivateWindow(window); |
1313 | 1313 |
1314 // App list and shelf is not shown. | 1314 // App list and shelf is not shown. |
1315 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 1315 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
1316 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); | 1316 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
1317 | 1317 |
1318 // Toggle app list to show. | 1318 // Toggle app list to show. |
1319 shell->ToggleAppList(NULL); | 1319 shell->ToggleAppList(NULL); |
1320 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 1320 EXPECT_TRUE(shell->GetAppListTargetVisibility()); |
1321 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); | 1321 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); |
1322 | 1322 |
1323 // Toggle app list to hide. | 1323 // Toggle app list to hide. |
1324 shell->ToggleAppList(NULL); | 1324 shell->ToggleAppList(NULL); |
1325 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 1325 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
1326 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); | 1326 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
1327 } | 1327 } |
1328 | 1328 |
| 1329 // Tests that the shelf is only hidden for an active fullscreen window and |
| 1330 // toggles visibility when another window is activated. |
| 1331 TEST_F(ShelfLayoutManagerTest, ActiveFullscreenWindowHidesShelf) { |
| 1332 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 1333 |
| 1334 // Create a window and make it full screen. |
| 1335 aura::Window* window1 = CreateTestWindow(); |
| 1336 window1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1337 window1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 1338 window1->Show(); |
| 1339 |
| 1340 aura::Window* window2 = CreateTestWindow(); |
| 1341 window2->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1342 window2->Show(); |
| 1343 |
| 1344 wm::GetWindowState(window1)->Activate(); |
| 1345 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
| 1346 |
| 1347 wm::GetWindowState(window2)->Activate(); |
| 1348 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); |
| 1349 |
| 1350 wm::GetWindowState(window1)->Activate(); |
| 1351 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
| 1352 } |
| 1353 |
1329 #if defined(OS_WIN) | 1354 #if defined(OS_WIN) |
1330 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 | 1355 // RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962 |
1331 #define MAYBE_SetAlignment DISABLED_SetAlignment | 1356 #define MAYBE_SetAlignment DISABLED_SetAlignment |
1332 #else | 1357 #else |
1333 #define MAYBE_SetAlignment SetAlignment | 1358 #define MAYBE_SetAlignment SetAlignment |
1334 #endif | 1359 #endif |
1335 | 1360 |
1336 // Tests SHELF_ALIGNMENT_(LEFT, RIGHT, TOP). | 1361 // Tests SHELF_ALIGNMENT_(LEFT, RIGHT, TOP). |
1337 TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { | 1362 TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { |
1338 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 1363 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); | 1880 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
1856 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1881 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1857 generator.ClickLeftButton(); | 1882 generator.ClickLeftButton(); |
1858 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); | 1883 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); |
1859 generator.ClickLeftButton(); | 1884 generator.ClickLeftButton(); |
1860 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1885 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1861 } | 1886 } |
1862 | 1887 |
1863 } // namespace internal | 1888 } // namespace internal |
1864 } // namespace ash | 1889 } // namespace ash |
OLD | NEW |