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/focus_cycler.h" | 5 #include "ash/focus_cycler.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Cycle the window | 38 // Cycle the window |
39 focus_cycler->RotateFocus(FocusCycler::FORWARD); | 39 focus_cycler->RotateFocus(FocusCycler::FORWARD); |
40 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 40 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
41 } | 41 } |
42 | 42 |
43 TEST_F(FocusCyclerTest, CycleFocusForward) { | 43 TEST_F(FocusCyclerTest, CycleFocusForward) { |
44 scoped_ptr<FocusCycler> focus_cycler(new FocusCycler()); | 44 scoped_ptr<FocusCycler> focus_cycler(new FocusCycler()); |
45 | 45 |
46 // Add the Status area | 46 // Add the Status area |
47 views::Widget* status_widget = internal::CreateStatusArea(); | 47 views::Widget* status_widget = internal::CreateStatusArea(NULL); |
48 ASSERT_TRUE(status_widget); | 48 ASSERT_TRUE(status_widget); |
49 focus_cycler->AddWidget(status_widget); | 49 focus_cycler->AddWidget(status_widget); |
50 | 50 |
51 // Add a mock button to the status area. | 51 // Add a mock button to the status area. |
52 status_widget->GetContentsView()->AddChildView( | 52 status_widget->GetContentsView()->AddChildView( |
53 new views::MenuButton(NULL, string16(), NULL, false)); | 53 new views::MenuButton(NULL, string16(), NULL, false)); |
54 | 54 |
55 // Add the launcher | 55 // Add the launcher |
56 Launcher* launcher = Shell::GetInstance()->launcher(); | 56 Launcher* launcher = Shell::GetInstance()->launcher(); |
57 ASSERT_TRUE(launcher); | 57 ASSERT_TRUE(launcher); |
(...skipping 20 matching lines...) Expand all Loading... |
78 | 78 |
79 // Cycle focus to the browser | 79 // Cycle focus to the browser |
80 focus_cycler->RotateFocus(FocusCycler::FORWARD); | 80 focus_cycler->RotateFocus(FocusCycler::FORWARD); |
81 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 81 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
82 } | 82 } |
83 | 83 |
84 TEST_F(FocusCyclerTest, CycleFocusBackward) { | 84 TEST_F(FocusCyclerTest, CycleFocusBackward) { |
85 scoped_ptr<FocusCycler> focus_cycler(new FocusCycler()); | 85 scoped_ptr<FocusCycler> focus_cycler(new FocusCycler()); |
86 | 86 |
87 // Add the Status area | 87 // Add the Status area |
88 views::Widget* status_widget = internal::CreateStatusArea(); | 88 views::Widget* status_widget = internal::CreateStatusArea(NULL); |
89 ASSERT_TRUE(status_widget); | 89 ASSERT_TRUE(status_widget); |
90 focus_cycler->AddWidget(status_widget); | 90 focus_cycler->AddWidget(status_widget); |
91 | 91 |
92 // Add a mock button to the status area. | 92 // Add a mock button to the status area. |
93 status_widget->GetContentsView()->AddChildView( | 93 status_widget->GetContentsView()->AddChildView( |
94 new views::MenuButton(NULL, string16(), NULL, false)); | 94 new views::MenuButton(NULL, string16(), NULL, false)); |
95 | 95 |
96 // Add the launcher | 96 // Add the launcher |
97 Launcher* launcher = Shell::GetInstance()->launcher(); | 97 Launcher* launcher = Shell::GetInstance()->launcher(); |
98 ASSERT_TRUE(launcher); | 98 ASSERT_TRUE(launcher); |
(...skipping 18 matching lines...) Expand all Loading... |
117 focus_cycler->RotateFocus(FocusCycler::BACKWARD); | 117 focus_cycler->RotateFocus(FocusCycler::BACKWARD); |
118 EXPECT_TRUE(status_widget->IsActive()); | 118 EXPECT_TRUE(status_widget->IsActive()); |
119 | 119 |
120 // Cycle focus to the browser | 120 // Cycle focus to the browser |
121 focus_cycler->RotateFocus(FocusCycler::BACKWARD); | 121 focus_cycler->RotateFocus(FocusCycler::BACKWARD); |
122 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); | 122 EXPECT_TRUE(wm::IsActiveWindow(window0.get())); |
123 } | 123 } |
124 | 124 |
125 } // namespace test | 125 } // namespace test |
126 } // namespace ash | 126 } // namespace ash |
OLD | NEW |