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/launcher/launcher_context_menu.h" | 5 #include "ash/launcher/launcher_context_menu.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/wm/property_util.h" | 9 #include "ash/wm/property_util.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 TEST_F(LauncherContextMenuTest, ToggleAutoHide) { | 22 TEST_F(LauncherContextMenuTest, ToggleAutoHide) { |
23 scoped_ptr<aura::Window> window(new aura::Window(NULL)); | 23 scoped_ptr<aura::Window> window(new aura::Window(NULL)); |
24 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 24 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
25 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | 25 window->SetType(aura::client::WINDOW_TYPE_NORMAL); |
26 window->Init(ui::LAYER_TEXTURED); | 26 window->Init(ui::LAYER_TEXTURED); |
27 window->SetParent(NULL); | 27 window->SetParent(NULL); |
28 window->Show(); | 28 window->Show(); |
29 wm::ActivateWindow(window.get()); | 29 wm::ActivateWindow(window.get()); |
30 | 30 |
31 Shell* shell = Shell::GetInstance(); | 31 Shell* shell = Shell::GetInstance(); |
32 shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 32 // If the auto-hide behavior isn't DEFAULT, the rest of the tests don't make |
| 33 // sense. |
| 34 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT, |
| 35 shell->GetShelfAutoHideBehavior()); |
| 36 EXPECT_FALSE(LauncherContextMenu::IsAutoHideMenuHideChecked()); |
| 37 shell->SetShelfAutoHideBehavior( |
| 38 LauncherContextMenu::GetToggledAutoHideBehavior()); |
33 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 39 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
34 shell->GetShelfAutoHideBehavior()); | 40 shell->GetShelfAutoHideBehavior()); |
| 41 shell->SetShelfAutoHideBehavior( |
| 42 LauncherContextMenu::GetToggledAutoHideBehavior()); |
| 43 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT, |
| 44 shell->GetShelfAutoHideBehavior()); |
| 45 |
| 46 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
35 EXPECT_TRUE(LauncherContextMenu::IsAutoHideMenuHideChecked()); | 47 EXPECT_TRUE(LauncherContextMenu::IsAutoHideMenuHideChecked()); |
36 shell->SetShelfAutoHideBehavior( | 48 shell->SetShelfAutoHideBehavior( |
37 LauncherContextMenu::GetToggledAutoHideBehavior()); | 49 LauncherContextMenu::GetToggledAutoHideBehavior()); |
38 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 50 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
39 shell->GetShelfAutoHideBehavior()); | 51 shell->GetShelfAutoHideBehavior()); |
40 | |
41 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | |
42 EXPECT_FALSE(LauncherContextMenu::IsAutoHideMenuHideChecked()); | |
43 shell->SetShelfAutoHideBehavior( | 52 shell->SetShelfAutoHideBehavior( |
44 LauncherContextMenu::GetToggledAutoHideBehavior()); | 53 LauncherContextMenu::GetToggledAutoHideBehavior()); |
45 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 54 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT, |
46 shell->GetShelfAutoHideBehavior()); | |
47 EXPECT_TRUE(LauncherContextMenu::IsAutoHideMenuHideChecked()); | |
48 shell->SetShelfAutoHideBehavior( | |
49 LauncherContextMenu::GetToggledAutoHideBehavior()); | |
50 EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | |
51 shell->GetShelfAutoHideBehavior()); | 55 shell->GetShelfAutoHideBehavior()); |
52 } | 56 } |
53 | 57 |
54 } // namespace ash | 58 } // namespace ash |
OLD | NEW |