OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.h" | 5 #include "ash/shelf/shelf.h" |
6 #include "ash/shelf/shelf_view.h" | 6 #include "ash/shelf/shelf_view.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/shelf_test_api.h" | 8 #include "ash/test/shelf_test_api.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 OpenBrowserUsingContextMenuOnOtherDisplay | 82 OpenBrowserUsingContextMenuOnOtherDisplay |
83 #endif | 83 #endif |
84 | 84 |
85 IN_PROC_BROWSER_TEST_F(WindowSizerTest, | 85 IN_PROC_BROWSER_TEST_F(WindowSizerTest, |
86 MAYBE_OpenBrowserUsingShelfOnOtherDisplay) { | 86 MAYBE_OpenBrowserUsingShelfOnOtherDisplay) { |
87 // Don't shutdown when closing the last browser window. | 87 // Don't shutdown when closing the last browser window. |
88 chrome::IncrementKeepAliveCount(); | 88 chrome::IncrementKeepAliveCount(); |
89 | 89 |
90 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 90 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); |
91 | 91 |
92 BrowserList* browser_list = | 92 BrowserList* browser_list = BrowserList::GetInstance(); |
93 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | |
94 | 93 |
95 EXPECT_EQ(1u, browser_list->size()); | 94 EXPECT_EQ(1u, browser_list->size()); |
96 // Close the browser window so that clicking icon will create a new window. | 95 // Close the browser window so that clicking icon will create a new window. |
97 CloseBrowser(browser_list->get(0)); | 96 CloseBrowser(browser_list->get(0)); |
98 EXPECT_EQ(0u, browser_list->size()); | 97 EXPECT_EQ(0u, browser_list->size()); |
99 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 98 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
100 | 99 |
101 OpenBrowserUsingShelfOnRootWindow(root_windows[1]); | 100 OpenBrowserUsingShelfOnRootWindow(root_windows[1]); |
102 | 101 |
103 // A new browser must be created on 2nd display. | 102 // A new browser must be created on 2nd display. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 170 |
172 IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest, | 171 IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest, |
173 MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay) { | 172 MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay) { |
174 // Don't shutdown when closing the last browser window. | 173 // Don't shutdown when closing the last browser window. |
175 chrome::IncrementKeepAliveCount(); | 174 chrome::IncrementKeepAliveCount(); |
176 | 175 |
177 views::MenuController::TurnOffMenuSelectionHoldForTest(); | 176 views::MenuController::TurnOffMenuSelectionHoldForTest(); |
178 | 177 |
179 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 178 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); |
180 | 179 |
181 BrowserList* browser_list = | 180 BrowserList* browser_list = BrowserList::GetInstance(); |
182 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | |
183 | 181 |
184 ASSERT_EQ(1u, browser_list->size()); | 182 ASSERT_EQ(1u, browser_list->size()); |
185 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 183 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
186 CloseBrowser(browser_list->get(0)); | 184 CloseBrowser(browser_list->get(0)); |
187 | 185 |
188 OpenBrowserUsingContextMenuOnRootWindow(root_windows[1]); | 186 OpenBrowserUsingContextMenuOnRootWindow(root_windows[1]); |
189 | 187 |
190 // A new browser must be created on 2nd display. | 188 // A new browser must be created on 2nd display. |
191 ASSERT_EQ(1u, browser_list->size()); | 189 ASSERT_EQ(1u, browser_list->size()); |
192 EXPECT_EQ(root_windows[1], | 190 EXPECT_EQ(root_windows[1], |
193 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); | 191 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); |
194 EXPECT_EQ(root_windows[1], ash::Shell::GetTargetRootWindow()); | 192 EXPECT_EQ(root_windows[1], ash::Shell::GetTargetRootWindow()); |
195 | 193 |
196 OpenBrowserUsingContextMenuOnRootWindow(root_windows[0]); | 194 OpenBrowserUsingContextMenuOnRootWindow(root_windows[0]); |
197 | 195 |
198 // Next new browser must be created on 1st display. | 196 // Next new browser must be created on 1st display. |
199 ASSERT_EQ(2u, browser_list->size()); | 197 ASSERT_EQ(2u, browser_list->size()); |
200 EXPECT_EQ(root_windows[0], | 198 EXPECT_EQ(root_windows[0], |
201 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); | 199 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); |
202 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 200 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
203 | 201 |
204 // Balanced with the chrome::IncrementKeepAliveCount above. | 202 // Balanced with the chrome::IncrementKeepAliveCount above. |
205 chrome::DecrementKeepAliveCount(); | 203 chrome::DecrementKeepAliveCount(); |
206 } | 204 } |
OLD | NEW |