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 "ash/test/launcher_test_api.h" |
8 #include "base/command_line.h" | 9 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 11 #include "chrome/browser/lifetime/application_lifetime.h" |
11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
13 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
16 #include "ui/aura/test/event_generator.h" | 17 #include "ui/aura/test/event_generator.h" |
17 #include "ui/base/test/ui_controls.h" | 18 #include "ui/base/test/ui_controls.h" |
(...skipping 20 matching lines...) Expand all Loading... |
38 }; | 39 }; |
39 | 40 |
40 void CloseBrowser(Browser* browser) { | 41 void CloseBrowser(Browser* browser) { |
41 browser->window()->Close(); | 42 browser->window()->Close(); |
42 base::MessageLoop::current()->RunUntilIdle(); | 43 base::MessageLoop::current()->RunUntilIdle(); |
43 } | 44 } |
44 | 45 |
45 gfx::Rect GetChromeIconBoundsForRootWindow(aura::RootWindow* root_window) { | 46 gfx::Rect GetChromeIconBoundsForRootWindow(aura::RootWindow* root_window) { |
46 ash::Launcher* launcher = ash::Launcher::ForWindow(root_window); | 47 ash::Launcher* launcher = ash::Launcher::ForWindow(root_window); |
47 const ash::internal::LauncherView* launcher_view = | 48 const ash::internal::LauncherView* launcher_view = |
48 launcher->GetLauncherViewForTest(); | 49 ash::test::LauncherTestAPI(launcher).launcher_view(); |
49 const views::ViewModel* view_model = launcher_view->view_model_for_test(); | 50 const views::ViewModel* view_model = launcher_view->view_model_for_test(); |
50 | 51 |
51 EXPECT_EQ(2, view_model->view_size()); | 52 EXPECT_EQ(2, view_model->view_size()); |
52 return view_model->view_at(1)->GetBoundsInScreen(); | 53 return view_model->view_at(1)->GetBoundsInScreen(); |
53 } | 54 } |
54 | 55 |
55 void OpenBrowserUsingShelfOnRootWindow(aura::RootWindow* root_window) { | 56 void OpenBrowserUsingShelfOnRootWindow(aura::RootWindow* root_window) { |
56 aura::test::EventGenerator generator(root_window); | 57 aura::test::EventGenerator generator(root_window); |
57 gfx::Point center = | 58 gfx::Point center = |
58 GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); | 59 GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 EXPECT_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::GetActiveRootWindow()); | 196 EXPECT_EQ(root_windows[0], ash::Shell::GetActiveRootWindow()); |
196 | 197 |
197 // Balanced with the chrome::StartKeepAlive above. | 198 // Balanced with the chrome::StartKeepAlive above. |
198 chrome::EndKeepAlive(); | 199 chrome::EndKeepAlive(); |
199 } | 200 } |
OLD | NEW |