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/run_loop.h" | 5 #include "base/run_loop.h" |
6 #include "chrome/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
7 #include "chrome/browser/ui/views/frame/browser_view.h" | 7 #include "chrome/browser/ui/views/frame/browser_view.h" |
8 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" | 8 #include "chrome/browser/ui/views/frame/test_with_browser_view.h" |
9 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" | 9 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" |
10 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 10 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
11 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 11 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
12 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" | 12 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" |
13 #include "chrome/test/base/interactive_test_utils.h" | 13 #include "chrome/test/base/interactive_test_utils.h" |
14 #include "extensions/common/feature_switch.h" | 14 #include "extensions/common/feature_switch.h" |
15 | 15 |
16 // Borrowed from chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc, | 16 // Borrowed from chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc, |
17 // since these are also disabled on Linux for drag and drop. | 17 // since these are also disabled on Linux for drag and drop. |
18 // TODO(erg): Fix DND tests on linux_aura. crbug.com/163931 | 18 // TODO(erg): Fix DND tests on linux_aura. crbug.com/163931 |
19 #if defined(OS_LINUX) && defined(USE_AURA) | 19 #if defined(OS_LINUX) && defined(USE_AURA) |
20 #define MAYBE(x) DISABLED_##x | 20 #define MAYBE(x) DISABLED_##x |
21 #else | 21 #else |
22 #define MAYBE(x) x | 22 #define MAYBE(x) x |
23 #endif | 23 #endif |
24 | 24 |
25 class ToolbarViewInteractiveUITest : public ExtensionBrowserTest { | 25 class ToolbarViewInteractiveUITest : public ExtensionBrowserTest { |
26 public: | 26 public: |
27 ToolbarViewInteractiveUITest(); | 27 ToolbarViewInteractiveUITest(); |
28 virtual ~ToolbarViewInteractiveUITest(); | 28 ~ToolbarViewInteractiveUITest() override; |
29 | 29 |
30 protected: | 30 protected: |
31 ToolbarView* toolbar_view() { return toolbar_view_; } | 31 ToolbarView* toolbar_view() { return toolbar_view_; } |
32 BrowserActionsContainer* browser_actions() { return browser_actions_; } | 32 BrowserActionsContainer* browser_actions() { return browser_actions_; } |
33 | 33 |
34 // Performs a drag-and-drop operation by moving the mouse to |start|, clicking | 34 // Performs a drag-and-drop operation by moving the mouse to |start|, clicking |
35 // the left button, moving the mouse to |end|, and releasing the left button. | 35 // the left button, moving the mouse to |end|, and releasing the left button. |
36 // TestWhileInDragOperation() is called after the mouse has moved to |end|, | 36 // TestWhileInDragOperation() is called after the mouse has moved to |end|, |
37 // but before the click is released. | 37 // but before the click is released. |
38 void DoDragAndDrop(const gfx::Point& start, const gfx::Point& end); | 38 void DoDragAndDrop(const gfx::Point& start, const gfx::Point& end); |
39 | 39 |
40 // A function to perform testing actions while in the drag operation from | 40 // A function to perform testing actions while in the drag operation from |
41 // DoDragAndDrop. | 41 // DoDragAndDrop. |
42 void TestWhileInDragOperation(); | 42 void TestWhileInDragOperation(); |
43 | 43 |
44 private: | 44 private: |
45 // Finishes the drag-and-drop operation started in DoDragAndDrop(). | 45 // Finishes the drag-and-drop operation started in DoDragAndDrop(). |
46 void FinishDragAndDrop(const base::Closure& quit_closure); | 46 void FinishDragAndDrop(const base::Closure& quit_closure); |
47 | 47 |
48 // InProcessBrowserTest: | 48 // InProcessBrowserTest: |
49 virtual void SetUpCommandLine(base::CommandLine* command_line) override; | 49 void SetUpCommandLine(base::CommandLine* command_line) override; |
50 virtual void SetUpOnMainThread() override; | 50 void SetUpOnMainThread() override; |
51 virtual void TearDownOnMainThread() override; | 51 void TearDownOnMainThread() override; |
52 | 52 |
53 ToolbarView* toolbar_view_; | 53 ToolbarView* toolbar_view_; |
54 | 54 |
55 BrowserActionsContainer* browser_actions_; | 55 BrowserActionsContainer* browser_actions_; |
56 | 56 |
57 // The drag-and-drop background thread. | 57 // The drag-and-drop background thread. |
58 scoped_ptr<base::Thread> dnd_thread_; | 58 scoped_ptr<base::Thread> dnd_thread_; |
59 | 59 |
60 // Override the extensions-action-redesign switch. | 60 // Override the extensions-action-redesign switch. |
61 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> feature_override_; | 61 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> feature_override_; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 ASSERT_TRUE(view); | 156 ASSERT_TRUE(view); |
157 | 157 |
158 gfx::Point browser_action_view_loc = test::GetCenterInScreenCoordinates(view); | 158 gfx::Point browser_action_view_loc = test::GetCenterInScreenCoordinates(view); |
159 gfx::Point wrench_button_loc = | 159 gfx::Point wrench_button_loc = |
160 test::GetCenterInScreenCoordinates(toolbar_view()->app_menu()); | 160 test::GetCenterInScreenCoordinates(toolbar_view()->app_menu()); |
161 | 161 |
162 // Perform a drag and drop from the browser action view to the wrench button, | 162 // Perform a drag and drop from the browser action view to the wrench button, |
163 // which should open the wrench menu. | 163 // which should open the wrench menu. |
164 DoDragAndDrop(browser_action_view_loc, wrench_button_loc); | 164 DoDragAndDrop(browser_action_view_loc, wrench_button_loc); |
165 } | 165 } |
OLD | NEW |