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/launcher/launcher.h" | 5 #include "ash/launcher/launcher.h" |
6 #include "ash/launcher/launcher_view.h" | 6 #include "ash/launcher/launcher_view.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 base::MessageLoop::current()->RunUntilIdle(); | 42 base::MessageLoop::current()->RunUntilIdle(); |
43 } | 43 } |
44 | 44 |
45 gfx::Rect GetChromeIconBoundsForRootWindow(aura::RootWindow* root_window) { | 45 gfx::Rect GetChromeIconBoundsForRootWindow(aura::RootWindow* root_window) { |
46 ash::Launcher* launcher = ash::Launcher::ForWindow(root_window); | 46 ash::Launcher* launcher = ash::Launcher::ForWindow(root_window); |
47 const ash::internal::LauncherView* launcher_view = | 47 const ash::internal::LauncherView* launcher_view = |
48 launcher->GetLauncherViewForTest(); | 48 launcher->GetLauncherViewForTest(); |
49 const views::ViewModel* view_model = launcher_view->view_model_for_test(); | 49 const views::ViewModel* view_model = launcher_view->view_model_for_test(); |
50 | 50 |
51 EXPECT_EQ(2, view_model->view_size()); | 51 EXPECT_EQ(2, view_model->view_size()); |
52 return view_model->view_at(0)->GetBoundsInScreen(); | 52 return view_model->view_at(1)->GetBoundsInScreen(); |
53 } | 53 } |
54 | 54 |
55 void OpenBrowserUsingShelfOnRootWindow(aura::RootWindow* root_window) { | 55 void OpenBrowserUsingShelfOnRootWindow(aura::RootWindow* root_window) { |
56 aura::test::EventGenerator generator(root_window); | 56 aura::test::EventGenerator generator(root_window); |
57 gfx::Point center = | 57 gfx::Point center = |
58 GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); | 58 GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); |
59 gfx::Display display = | 59 gfx::Display display = |
60 ash::Shell::GetScreen()->GetDisplayNearestWindow(root_window); | 60 ash::Shell::GetScreen()->GetDisplayNearestWindow(root_window); |
61 const gfx::Point& origin = display.bounds().origin(); | 61 const gfx::Point& origin = display.bounds().origin(); |
62 center.Offset(- origin.x(), - origin.y()); | 62 center.Offset(- origin.x(), - origin.y()); |
63 generator.MoveMouseTo(center); | 63 generator.MoveMouseTo(center); |
64 generator.ClickLeftButton(); | 64 generator.ClickLeftButton(); |
65 } | 65 } |
66 | 66 |
67 } // namespace | 67 } // namespace |
68 | 68 |
69 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
70 #define MAYBE_OpenBrowserUsingShelfOnOhterDisplay DISABLED_OpenBrowserUsingShelf
OnOhterDisplay | 70 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay DISABLED_OpenBrowserUsingShelf
OnOtherDisplay |
71 #define MAYBE_OpenBrowserUsingContextMenuOnOhterDisplay DISABLED_OpenBrowserUsin
gContextMenuOnOhterDisplay | 71 #define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay DISABLED_OpenBrowserUsin
gContextMenuOnOtherDisplay |
72 #else | 72 #else |
73 #define MAYBE_OpenBrowserUsingShelfOnOhterDisplay OpenBrowserUsingShelfOnOhterDi
splay | 73 #define MAYBE_OpenBrowserUsingShelfOnOtherDisplay OpenBrowserUsingShelfOnOtherDi
splay |
74 #define MAYBE_OpenBrowserUsingContextMenuOnOhterDisplay OpenBrowserUsingContextM
enuOnOhterDisplay | 74 #define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay OpenBrowserUsingContextM
enuOnOtherDisplay |
75 #endif | 75 #endif |
76 | 76 |
77 IN_PROC_BROWSER_TEST_F(WindowSizerTest, | 77 IN_PROC_BROWSER_TEST_F(WindowSizerTest, |
78 MAYBE_OpenBrowserUsingShelfOnOhterDisplay) { | 78 MAYBE_OpenBrowserUsingShelfOnOtherDisplay) { |
79 // Don't shutdown when closing the last browser window. | 79 // Don't shutdown when closing the last browser window. |
80 chrome::StartKeepAlive(); | 80 chrome::StartKeepAlive(); |
81 | 81 |
82 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); | 82 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
83 | 83 |
84 BrowserList* browser_list = | 84 BrowserList* browser_list = |
85 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 85 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
86 | 86 |
87 EXPECT_EQ(1u, browser_list->size()); | 87 EXPECT_EQ(1u, browser_list->size()); |
88 // Close the browser window so that clicking icon will create a new window. | 88 // Close the browser window so that clicking icon will create a new window. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 release_point.Offset(50, -120); | 156 release_point.Offset(50, -120); |
157 ui_controls::SendMouseMoveNotifyWhenDone( | 157 ui_controls::SendMouseMoveNotifyWhenDone( |
158 chrome_icon.x(), chrome_icon.y(), | 158 chrome_icon.x(), chrome_icon.y(), |
159 base::Bind(&WindowSizerContextMenuTest::Step1, release_point)); | 159 base::Bind(&WindowSizerContextMenuTest::Step1, release_point)); |
160 base::MessageLoop::current()->Run(); | 160 base::MessageLoop::current()->Run(); |
161 } | 161 } |
162 | 162 |
163 } // namespace | 163 } // namespace |
164 | 164 |
165 IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest, | 165 IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest, |
166 MAYBE_OpenBrowserUsingContextMenuOnOhterDisplay) { | 166 MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay) { |
167 // Don't shutdown when closing the last browser window. | 167 // Don't shutdown when closing the last browser window. |
168 chrome::StartKeepAlive(); | 168 chrome::StartKeepAlive(); |
169 | 169 |
170 views::MenuController::TurnOffMenuSelectionHoldForTest(); | 170 views::MenuController::TurnOffMenuSelectionHoldForTest(); |
171 | 171 |
172 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); | 172 ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); |
173 | 173 |
174 BrowserList* browser_list = | 174 BrowserList* browser_list = |
175 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 175 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); |
176 | 176 |
(...skipping 13 matching lines...) Expand all Loading... |
190 | 190 |
191 // Next new browser must be created on 1st display. | 191 // Next new browser must be created on 1st display. |
192 EXPECT_EQ(2u, browser_list->size()); | 192 EXPECT_EQ(2u, browser_list->size()); |
193 EXPECT_EQ(root_windows[0], | 193 EXPECT_EQ(root_windows[0], |
194 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); | 194 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); |
195 EXPECT_EQ(root_windows[0], ash::Shell::GetActiveRootWindow()); | 195 EXPECT_EQ(root_windows[0], ash::Shell::GetActiveRootWindow()); |
196 | 196 |
197 // Balanced with the chrome::StartKeepAlive above. | 197 // Balanced with the chrome::StartKeepAlive above. |
198 chrome::EndKeepAlive(); | 198 chrome::EndKeepAlive(); |
199 } | 199 } |
OLD | NEW |