| 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/location.h" |
| 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" |
| 11 #include "chrome/browser/lifetime/application_lifetime.h" | 13 #include "chrome/browser/lifetime/application_lifetime.h" |
| 12 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
| 16 #include "ui/aura/window_event_dispatcher.h" | 18 #include "ui/aura/window_event_dispatcher.h" |
| 17 #include "ui/base/test/ui_controls.h" | 19 #include "ui/base/test/ui_controls.h" |
| 18 #include "ui/events/test/event_generator.h" | 20 #include "ui/events/test/event_generator.h" |
| 19 #include "ui/views/controls/menu/menu_controller.h" | 21 #include "ui/views/controls/menu/menu_controller.h" |
| 20 #include "ui/views/view.h" | 22 #include "ui/views/view.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 base::Bind(&WindowSizerContextMenuTest::Step3)); | 136 base::Bind(&WindowSizerContextMenuTest::Step3)); |
| 135 } | 137 } |
| 136 | 138 |
| 137 static void Step3() { | 139 static void Step3() { |
| 138 ui_controls::SendMouseEventsNotifyWhenDone( | 140 ui_controls::SendMouseEventsNotifyWhenDone( |
| 139 ui_controls::RIGHT, ui_controls::UP, | 141 ui_controls::RIGHT, ui_controls::UP, |
| 140 base::Bind(&WindowSizerContextMenuTest::QuitLoop)); | 142 base::Bind(&WindowSizerContextMenuTest::QuitLoop)); |
| 141 } | 143 } |
| 142 | 144 |
| 143 static void QuitLoop() { | 145 static void QuitLoop() { |
| 144 base::MessageLoop::current()->PostTask( | 146 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 145 FROM_HERE, | 147 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 146 base::MessageLoop::QuitWhenIdleClosure()); | |
| 147 } | 148 } |
| 148 | 149 |
| 149 private: | 150 private: |
| 150 DISALLOW_COPY_AND_ASSIGN(WindowSizerContextMenuTest); | 151 DISALLOW_COPY_AND_ASSIGN(WindowSizerContextMenuTest); |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 void OpenBrowserUsingContextMenuOnRootWindow(aura::Window* root_window) { | 154 void OpenBrowserUsingContextMenuOnRootWindow(aura::Window* root_window) { |
| 154 gfx::Point chrome_icon = | 155 gfx::Point chrome_icon = |
| 155 GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); | 156 GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); |
| 156 gfx::Point release_point = chrome_icon; | 157 gfx::Point release_point = chrome_icon; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 192 |
| 192 // Next new browser must be created on 1st display. | 193 // Next new browser must be created on 1st display. |
| 193 ASSERT_EQ(2u, browser_list->size()); | 194 ASSERT_EQ(2u, browser_list->size()); |
| 194 EXPECT_EQ(root_windows[0], | 195 EXPECT_EQ(root_windows[0], |
| 195 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); | 196 browser_list->get(1)->window()->GetNativeWindow()->GetRootWindow()); |
| 196 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 197 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
| 197 | 198 |
| 198 // Balanced with the chrome::IncrementKeepAliveCount above. | 199 // Balanced with the chrome::IncrementKeepAliveCount above. |
| 199 chrome::DecrementKeepAliveCount(); | 200 chrome::DecrementKeepAliveCount(); |
| 200 } | 201 } |
| OLD | NEW |