| 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/wm/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/focus_cycler.h" | 7 #include "ash/focus_cycler.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/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // it when the user is using the keyboard (i.e. through FocusCycler). | 394 // it when the user is using the keyboard (i.e. through FocusCycler). |
| 395 shelf->status()->Activate(); | 395 shelf->status()->Activate(); |
| 396 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 396 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
| 397 | 397 |
| 398 shelf->launcher()->GetFocusCycler()->RotateFocus(FocusCycler::FORWARD); | 398 shelf->launcher()->GetFocusCycler()->RotateFocus(FocusCycler::FORWARD); |
| 399 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); | 399 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); |
| 400 } | 400 } |
| 401 | 401 |
| 402 // Makes sure shelf will be visible when app list opens as shelf is in VISIBLE | 402 // Makes sure shelf will be visible when app list opens as shelf is in VISIBLE |
| 403 // state,and toggling app list won't change shelf visibility state. | 403 // state,and toggling app list won't change shelf visibility state. |
| 404 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) { | 404 // Disabled due to a real bug, see http://crbug.com/127538. |
| 405 TEST_F(ShelfLayoutManagerTest, DISABLED_OpenAppListWithShelfVisibleState) { |
| 405 Shell* shell = Shell::GetInstance(); | 406 Shell* shell = Shell::GetInstance(); |
| 406 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 407 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); |
| 407 shelf->LayoutShelf(); | 408 shelf->LayoutShelf(); |
| 408 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT); | 409 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT); |
| 409 | 410 |
| 410 // Create a normal unmaximized windowm shelf should be visible. | 411 // Create a normal unmaximized windowm shelf should be visible. |
| 411 aura::Window* window = CreateTestWindow(); | 412 aura::Window* window = CreateTestWindow(); |
| 412 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 413 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 413 window->Show(); | 414 window->Show(); |
| 414 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 415 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
| 415 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 416 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 416 | 417 |
| 417 // Toggle app list to show, and the shelf stays visible. | 418 // Toggle app list to show, and the shelf stays visible. |
| 418 shell->ToggleAppList(); | 419 shell->ToggleAppList(); |
| 419 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 420 EXPECT_TRUE(shell->GetAppListTargetVisibility()); |
| 420 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 421 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 421 | 422 |
| 422 // Toggle app list to hide, and the shelf stays visible. | 423 // Toggle app list to hide, and the shelf stays visible. |
| 423 shell->ToggleAppList(); | 424 shell->ToggleAppList(); |
| 424 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 425 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
| 425 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 426 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 426 } | 427 } |
| 427 | 428 |
| 428 // Makes sure shelf will be shown with AUTO_HIDE_SHOWN state when app list opens | 429 // Makes sure shelf will be shown with AUTO_HIDE_SHOWN state when app list opens |
| 429 // as shelf is in AUTO_HIDE state, and toggling app list won't change shelf | 430 // as shelf is in AUTO_HIDE state, and toggling app list won't change shelf |
| 430 // visibility state. | 431 // visibility state. |
| 431 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) { | 432 // Disabled due to a real bug, see http://crbug.com/127538. |
| 433 TEST_F(ShelfLayoutManagerTest, DISABLED_OpenAppListWithShelfAutoHideState) { |
| 432 Shell* shell = Shell::GetInstance(); | 434 Shell* shell = Shell::GetInstance(); |
| 433 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 435 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); |
| 434 shelf->LayoutShelf(); | 436 shelf->LayoutShelf(); |
| 435 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT); | 437 shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT); |
| 436 | 438 |
| 437 // Create a window and show it in maximized state. | 439 // Create a window and show it in maximized state. |
| 438 aura::Window* window = CreateTestWindow(); | 440 aura::Window* window = CreateTestWindow(); |
| 439 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 441 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 440 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 442 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 441 window->Show(); | 443 window->Show(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 454 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); | 456 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE_SHOWN, shelf->auto_hide_state()); |
| 455 | 457 |
| 456 // Toggle app list to hide. | 458 // Toggle app list to hide. |
| 457 shell->ToggleAppList(); | 459 shell->ToggleAppList(); |
| 458 EXPECT_FALSE(shell->GetAppListTargetVisibility()); | 460 EXPECT_FALSE(shell->GetAppListTargetVisibility()); |
| 459 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); | 461 EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); |
| 460 } | 462 } |
| 461 | 463 |
| 462 // Makes sure shelf will be hidden when app list opens as shelf is in HIDDEN | 464 // Makes sure shelf will be hidden when app list opens as shelf is in HIDDEN |
| 463 // state, and toggling app list won't change shelf visibility state. | 465 // state, and toggling app list won't change shelf visibility state. |
| 464 TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) { | 466 // Disabled due to a real bug, see http://crbug.com/127538. |
| 467 TEST_F(ShelfLayoutManagerTest, DISABLED_OpenAppListWithShelfHiddenState) { |
| 465 Shell* shell = Shell::GetInstance(); | 468 Shell* shell = Shell::GetInstance(); |
| 466 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 469 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); |
| 467 // For shelf to be visible, app list is not open in initial state. | 470 // For shelf to be visible, app list is not open in initial state. |
| 468 shelf->LayoutShelf(); | 471 shelf->LayoutShelf(); |
| 469 | 472 |
| 470 // Create a window and make it full screen. | 473 // Create a window and make it full screen. |
| 471 aura::Window* window = CreateTestWindow(); | 474 aura::Window* window = CreateTestWindow(); |
| 472 window->SetBounds(gfx::Rect(0, 0, 100, 100)); | 475 window->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 473 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 476 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 474 window->Show(); | 477 window->Show(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 EXPECT_EQ(0, monitor.GetWorkAreaInsets().top()); | 544 EXPECT_EQ(0, monitor.GetWorkAreaInsets().top()); |
| 542 EXPECT_EQ(0, monitor.GetWorkAreaInsets().bottom()); | 545 EXPECT_EQ(0, monitor.GetWorkAreaInsets().bottom()); |
| 543 EXPECT_EQ(0, monitor.GetWorkAreaInsets().left()); | 546 EXPECT_EQ(0, monitor.GetWorkAreaInsets().left()); |
| 544 EXPECT_EQ(monitor.work_area().right(), launcher_bounds.x()); | 547 EXPECT_EQ(monitor.work_area().right(), launcher_bounds.x()); |
| 545 EXPECT_EQ(monitor.bounds().y(), launcher_bounds.y()); | 548 EXPECT_EQ(monitor.bounds().y(), launcher_bounds.y()); |
| 546 EXPECT_EQ(monitor.bounds().height(), launcher_bounds.height()); | 549 EXPECT_EQ(monitor.bounds().height(), launcher_bounds.height()); |
| 547 } | 550 } |
| 548 | 551 |
| 549 } // namespace internal | 552 } // namespace internal |
| 550 } // namespace ash | 553 } // namespace ash |
| OLD | NEW |