| 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/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 widget->Restore(); | 436 widget->Restore(); |
| 437 EXPECT_EQ( | 437 EXPECT_EQ( |
| 438 SHELF_VISIBLE, | 438 SHELF_VISIBLE, |
| 439 Shell::GetPrimaryRootWindowController()-> | 439 Shell::GetPrimaryRootWindowController()-> |
| 440 GetShelfLayoutManager()->visibility_state()); | 440 GetShelfLayoutManager()->visibility_state()); |
| 441 | 441 |
| 442 // Clean up. | 442 // Clean up. |
| 443 widget->Close(); | 443 widget->Close(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 // Various assertions around SetShelfAutoHideBehavior() and | 446 // Various assertions around auto-hide behavior. |
| 447 // GetShelfAutoHideBehavior(). | 447 // TODO(jamescook): Move this to ShelfTest. |
| 448 TEST_F(ShellTest, ToggleAutoHide) { | 448 TEST_F(ShellTest, ToggleAutoHide) { |
| 449 std::unique_ptr<aura::Window> window(new aura::Window(NULL)); | 449 std::unique_ptr<aura::Window> window(new aura::Window(NULL)); |
| 450 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 450 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 451 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 451 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 452 window->Init(ui::LAYER_TEXTURED); | 452 window->Init(ui::LAYER_TEXTURED); |
| 453 ParentWindowInPrimaryRootWindow(window.get()); | 453 ParentWindowInPrimaryRootWindow(window.get()); |
| 454 window->Show(); | 454 window->Show(); |
| 455 wm::ActivateWindow(window.get()); | 455 wm::ActivateWindow(window.get()); |
| 456 | 456 |
| 457 Shell* shell = Shell::GetInstance(); | 457 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 458 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 458 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 459 shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 459 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
| 460 root_window); | 460 |
| 461 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 461 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 462 shell->GetShelfAutoHideBehavior(root_window)); | 462 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); |
| 463 shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 463 |
| 464 root_window); | |
| 465 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | |
| 466 shell->GetShelfAutoHideBehavior(root_window)); | |
| 467 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 464 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 468 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 465 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); |
| 469 shell->GetShelfAutoHideBehavior(root_window)); | 466 |
| 470 shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 467 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 471 root_window); | 468 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
| 472 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 469 |
| 473 shell->GetShelfAutoHideBehavior(root_window)); | 470 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 474 shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 471 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); |
| 475 root_window); | |
| 476 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | |
| 477 shell->GetShelfAutoHideBehavior(root_window)); | |
| 478 } | 472 } |
| 479 | 473 |
| 480 // Tests that the cursor-filter is ahead of the drag-drop controller in the | 474 // Tests that the cursor-filter is ahead of the drag-drop controller in the |
| 481 // pre-target list. | 475 // pre-target list. |
| 482 TEST_F(ShellTest, TestPreTargetHandlerOrder) { | 476 TEST_F(ShellTest, TestPreTargetHandlerOrder) { |
| 483 Shell* shell = Shell::GetInstance(); | 477 Shell* shell = Shell::GetInstance(); |
| 484 ui::EventTargetTestApi test_api(shell); | 478 ui::EventTargetTestApi test_api(shell); |
| 485 test::ShellTestApi shell_test_api(shell); | 479 test::ShellTestApi shell_test_api(shell); |
| 486 | 480 |
| 487 const ui::EventHandlerList& handlers = test_api.pre_target_handlers(); | 481 const ui::EventHandlerList& handlers = test_api.pre_target_handlers(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 private: | 517 private: |
| 524 DISALLOW_COPY_AND_ASSIGN(ShellTest2); | 518 DISALLOW_COPY_AND_ASSIGN(ShellTest2); |
| 525 }; | 519 }; |
| 526 | 520 |
| 527 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { | 521 TEST_F(ShellTest2, DontCrashWhenWindowDeleted) { |
| 528 window_.reset(new aura::Window(NULL)); | 522 window_.reset(new aura::Window(NULL)); |
| 529 window_->Init(ui::LAYER_NOT_DRAWN); | 523 window_->Init(ui::LAYER_NOT_DRAWN); |
| 530 } | 524 } |
| 531 | 525 |
| 532 } // namespace ash | 526 } // namespace ash |
| OLD | NEW |