| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/location.h" |
| 5 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/single_thread_task_runner.h" |
| 6 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
| 7 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" | 9 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" |
| 8 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 9 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" | 11 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" |
| 10 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" | 12 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" |
| 11 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 13 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 12 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 13 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" | 15 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" |
| 14 #include "chrome/test/base/interactive_test_utils.h" | 16 #include "chrome/test/base/interactive_test_utils.h" |
| 15 #include "extensions/common/feature_switch.h" | 17 #include "extensions/common/feature_switch.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 base::Bind(&ToolbarViewInteractiveUITest::FinishDragAndDrop, | 93 base::Bind(&ToolbarViewInteractiveUITest::FinishDragAndDrop, |
| 92 base::Unretained(this), | 94 base::Unretained(this), |
| 93 runner->QuitClosure())); | 95 runner->QuitClosure())); |
| 94 | 96 |
| 95 // Also post a move task to the drag and drop thread. | 97 // Also post a move task to the drag and drop thread. |
| 96 if (!dnd_thread_.get()) { | 98 if (!dnd_thread_.get()) { |
| 97 dnd_thread_.reset(new base::Thread("mouse_move_thread")); | 99 dnd_thread_.reset(new base::Thread("mouse_move_thread")); |
| 98 dnd_thread_->Start(); | 100 dnd_thread_->Start(); |
| 99 } | 101 } |
| 100 | 102 |
| 101 dnd_thread_->message_loop()->PostDelayedTask( | 103 dnd_thread_->task_runner()->PostDelayedTask( |
| 102 FROM_HERE, | 104 FROM_HERE, base::Bind(base::IgnoreResult(&ui_controls::SendMouseMove), |
| 103 base::Bind(base::IgnoreResult(&ui_controls::SendMouseMove), | 105 end.x(), end.y()), |
| 104 end.x(), | |
| 105 end.y()), | |
| 106 base::TimeDelta::FromMilliseconds(200)); | 106 base::TimeDelta::FromMilliseconds(200)); |
| 107 runner->Run(); | 107 runner->Run(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void ToolbarViewInteractiveUITest::TestWhileInDragOperation() { | 110 void ToolbarViewInteractiveUITest::TestWhileInDragOperation() { |
| 111 EXPECT_TRUE(toolbar_view()->IsWrenchMenuShowing()); | 111 EXPECT_TRUE(toolbar_view()->IsWrenchMenuShowing()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ToolbarViewInteractiveUITest::FinishDragAndDrop( | 114 void ToolbarViewInteractiveUITest::FinishDragAndDrop( |
| 115 const base::Closure& quit_closure) { | 115 const base::Closure& quit_closure) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 ASSERT_TRUE(view); | 157 ASSERT_TRUE(view); |
| 158 | 158 |
| 159 gfx::Point browser_action_view_loc = test::GetCenterInScreenCoordinates(view); | 159 gfx::Point browser_action_view_loc = test::GetCenterInScreenCoordinates(view); |
| 160 gfx::Point wrench_button_loc = | 160 gfx::Point wrench_button_loc = |
| 161 test::GetCenterInScreenCoordinates(toolbar_view()->app_menu()); | 161 test::GetCenterInScreenCoordinates(toolbar_view()->app_menu()); |
| 162 | 162 |
| 163 // Perform a drag and drop from the browser action view to the wrench button, | 163 // Perform a drag and drop from the browser action view to the wrench button, |
| 164 // which should open the wrench menu. | 164 // which should open the wrench menu. |
| 165 DoDragAndDrop(browser_action_view_loc, wrench_button_loc); | 165 DoDragAndDrop(browser_action_view_loc, wrench_button_loc); |
| 166 } | 166 } |
| OLD | NEW |