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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const gfx::Point& origin = display.bounds().origin(); | 62 const gfx::Point& origin = display.bounds().origin(); |
63 center.Offset(- origin.x(), - origin.y()); | 63 center.Offset(- origin.x(), - origin.y()); |
64 generator.MoveMouseTo(center); | 64 generator.MoveMouseTo(center); |
65 generator.ClickLeftButton(); | 65 generator.ClickLeftButton(); |
66 } | 66 } |
67 | 67 |
68 } // namespace | 68 } // namespace |
69 | 69 |
70 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
71 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay DISABLED_OpenBrowserUsingShelf
OnOtherDisplay | 71 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay DISABLED_OpenBrowserUsingShelf
OnOtherDisplay |
| 72 #define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay DISABLED_OpenBrowserUsin
gContextMenuOnOtherDisplay |
72 #else | 73 #else |
73 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay OpenBrowserUsingShelfOnOtherDi
splay | 74 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay OpenBrowserUsingShelfOnOtherDi
splay |
| 75 #define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay OpenBrowserUsingContextM
enuOnOtherDisplay |
74 #endif | 76 #endif |
75 | 77 |
76 IN_PROC_BROWSER_TEST_F(WindowSizerTest, | 78 IN_PROC_BROWSER_TEST_F(WindowSizerTest, |
77 MAYBE_OpenBrowserUsingShelfOnOtherDisplay) { | 79 MAYBE_OpenBrowserUsingShelfOnOtherDisplay) { |
78 // Don't shutdown when closing the last browser window. | 80 // Don't shutdown when closing the last browser window. |
79 chrome::IncrementKeepAliveCount(); | 81 chrome::IncrementKeepAliveCount(); |
80 | 82 |
81 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 83 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); |
82 | 84 |
83 BrowserList* browser_list = | 85 BrowserList* browser_list = |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 gfx::Point release_point = chrome_icon; | 156 gfx::Point release_point = chrome_icon; |
155 release_point.Offset(50, -120); | 157 release_point.Offset(50, -120); |
156 ui_controls::SendMouseMoveNotifyWhenDone( | 158 ui_controls::SendMouseMoveNotifyWhenDone( |
157 chrome_icon.x(), chrome_icon.y(), | 159 chrome_icon.x(), chrome_icon.y(), |
158 base::Bind(&WindowSizerContextMenuTest::Step1, release_point)); | 160 base::Bind(&WindowSizerContextMenuTest::Step1, release_point)); |
159 base::MessageLoop::current()->Run(); | 161 base::MessageLoop::current()->Run(); |
160 } | 162 } |
161 | 163 |
162 } // namespace | 164 } // namespace |
163 | 165 |
164 // Test is flaky: http://crbug.com/346799 | |
165 IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest, | 166 IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest, |
166 DISABLED_OpenBrowserUsingContextMenuOnOtherDisplay) { | 167 MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay) { |
167 // Don't shutdown when closing the last browser window. | 168 // Don't shutdown when closing the last browser window. |
168 chrome::IncrementKeepAliveCount(); | 169 chrome::IncrementKeepAliveCount(); |
169 | 170 |
170 views::MenuController::TurnOffMenuSelectionHoldForTest(); | 171 views::MenuController::TurnOffMenuSelectionHoldForTest(); |
171 | 172 |
172 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); | 173 aura::Window::Windows root_windows = ash::Shell::GetAllRootWindows(); |
173 | 174 |
174 BrowserList* browser_list = | 175 BrowserList* browser_list = |
175 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 176 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
176 | 177 |
177 EXPECT_EQ(1u, browser_list->size()); | 178 ASSERT_EQ(1u, browser_list->size()); |
178 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 179 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
179 CloseBrowser(browser_list->get(0)); | 180 CloseBrowser(browser_list->get(0)); |
180 | 181 |
181 OpenBrowserUsingContextMenuOnRootWindow(root_windows[1]); | 182 OpenBrowserUsingContextMenuOnRootWindow(root_windows[1]); |
182 | 183 |
183 // A new browser must be created on 2nd display. | 184 // A new browser must be created on 2nd display. |
184 EXPECT_EQ(1u, browser_list->size()); | 185 ASSERT_EQ(1u, browser_list->size()); |
185 EXPECT_EQ(root_windows[1], | 186 EXPECT_EQ(root_windows[1], |
186 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); | 187 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); |
187 EXPECT_EQ(root_windows[1], ash::Shell::GetTargetRootWindow()); | 188 EXPECT_EQ(root_windows[1], ash::Shell::GetTargetRootWindow()); |
188 | 189 |
189 OpenBrowserUsingContextMenuOnRootWindow(root_windows[0]); | 190 OpenBrowserUsingContextMenuOnRootWindow(root_windows[0]); |
190 | 191 |
191 // Next new browser must be created on 1st display. | 192 // Next new browser must be created on 1st display. |
192 EXPECT_EQ(2u, browser_list->size()); | 193 ASSERT_EQ(2u, browser_list->size()); |
193 EXPECT_EQ(root_windows[0], | 194 EXPECT_EQ(root_windows[0], |
194 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); | 195 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); |
195 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 196 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
196 | 197 |
197 // Balanced with the chrome::IncrementKeepAliveCount above. | 198 // Balanced with the chrome::IncrementKeepAliveCount above. |
198 chrome::DecrementKeepAliveCount(); | 199 chrome::DecrementKeepAliveCount(); |
199 } | 200 } |
OLD | NEW |