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/aura/wm_window_aura.h" | 5 #include "ash/aura/wm_window_aura.h" |
6 #include "ash/common/shelf/shelf.h" | |
7 #include "ash/common/shelf/shelf_view.h" | 6 #include "ash/common/shelf/shelf_view.h" |
| 7 #include "ash/common/shelf/wm_shelf.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/shelf_test_api.h" | |
10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
11 #include "base/location.h" | 10 #include "base/location.h" |
12 #include "base/macros.h" | 11 #include "base/macros.h" |
13 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
14 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
15 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
17 #include "build/build_config.h" | 16 #include "build/build_config.h" |
18 #include "chrome/browser/lifetime/keep_alive_types.h" | 17 #include "chrome/browser/lifetime/keep_alive_types.h" |
19 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 18 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
(...skipping 27 matching lines...) Expand all Loading... |
47 private: | 46 private: |
48 DISALLOW_COPY_AND_ASSIGN(WindowSizerTest); | 47 DISALLOW_COPY_AND_ASSIGN(WindowSizerTest); |
49 }; | 48 }; |
50 | 49 |
51 void CloseBrowser(Browser* browser) { | 50 void CloseBrowser(Browser* browser) { |
52 browser->window()->Close(); | 51 browser->window()->Close(); |
53 base::RunLoop().RunUntilIdle(); | 52 base::RunLoop().RunUntilIdle(); |
54 } | 53 } |
55 | 54 |
56 gfx::Rect GetChromeIconBoundsForRootWindow(aura::Window* root_window) { | 55 gfx::Rect GetChromeIconBoundsForRootWindow(aura::Window* root_window) { |
57 ash::Shelf* shelf = | |
58 ash::Shelf::ForWindow(ash::WmWindowAura::Get(root_window)); | |
59 const ash::ShelfView* shelf_view = | 56 const ash::ShelfView* shelf_view = |
60 ash::test::ShelfTestAPI(shelf).shelf_view(); | 57 ash::WmShelf::ForWindow(ash::WmWindowAura::Get(root_window)) |
| 58 ->GetShelfViewForTesting(); |
61 const views::ViewModel* view_model = shelf_view->view_model_for_test(); | 59 const views::ViewModel* view_model = shelf_view->view_model_for_test(); |
62 | 60 |
63 EXPECT_EQ(2, view_model->view_size()); | 61 EXPECT_EQ(2, view_model->view_size()); |
64 return view_model->view_at(1)->GetBoundsInScreen(); | 62 return view_model->view_at(1)->GetBoundsInScreen(); |
65 } | 63 } |
66 | 64 |
67 void OpenBrowserUsingShelfOnRootWindow(aura::Window* root_window) { | 65 void OpenBrowserUsingShelfOnRootWindow(aura::Window* root_window) { |
68 ui::test::EventGenerator generator(root_window); | 66 ui::test::EventGenerator generator(root_window); |
69 gfx::Point center = | 67 gfx::Point center = |
70 GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); | 68 GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 198 |
201 CloseBrowser(browser_list->get(0)); | 199 CloseBrowser(browser_list->get(0)); |
202 OpenBrowserUsingContextMenuOnRootWindow(root_windows[0]); | 200 OpenBrowserUsingContextMenuOnRootWindow(root_windows[0]); |
203 | 201 |
204 // Next new browser must be created on 1st display. | 202 // Next new browser must be created on 1st display. |
205 ASSERT_EQ(1u, browser_list->size()); | 203 ASSERT_EQ(1u, browser_list->size()); |
206 EXPECT_EQ(root_windows[0], | 204 EXPECT_EQ(root_windows[0], |
207 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); | 205 browser_list->get(0)->window()->GetNativeWindow()->GetRootWindow()); |
208 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 206 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
209 } | 207 } |
OLD | NEW |