Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_view_interactive_uitest.cc

Issue 497583003: Fix test failures in ToolbarViewInteractiveUITest.TestWrenchMenuOpensOnDrag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 30 matching lines...) Expand all
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 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE;
50 virtual void SetUpOnMainThread() OVERRIDE; 50 virtual void SetUpOnMainThread() OVERRIDE;
51 virtual void TearDownOnMainThread() OVERRIDE;
51 52
52 ToolbarView* toolbar_view_; 53 ToolbarView* toolbar_view_;
53 54
54 BrowserActionsContainer* browser_actions_; 55 BrowserActionsContainer* browser_actions_;
55 56
56 // The drag-and-drop background thread. 57 // The drag-and-drop background thread.
57 scoped_ptr<base::Thread> dnd_thread_; 58 scoped_ptr<base::Thread> dnd_thread_;
58 59
59 // Override the extensions-action-redesign switch. 60 // Override the extensions-action-redesign switch.
60 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> feature_override_; 61 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> feature_override_;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 quit_closure); 119 quit_closure);
119 } 120 }
120 121
121 void ToolbarViewInteractiveUITest::SetUpCommandLine( 122 void ToolbarViewInteractiveUITest::SetUpCommandLine(
122 base::CommandLine* command_line) { 123 base::CommandLine* command_line) {
123 ExtensionBrowserTest::SetUpCommandLine(command_line); 124 ExtensionBrowserTest::SetUpCommandLine(command_line);
124 // We do this before the rest of the setup because it can affect how the views 125 // We do this before the rest of the setup because it can affect how the views
125 // are constructed. 126 // are constructed.
126 feature_override_.reset(new extensions::FeatureSwitch::ScopedOverride( 127 feature_override_.reset(new extensions::FeatureSwitch::ScopedOverride(
127 extensions::FeatureSwitch::extension_action_redesign(), true)); 128 extensions::FeatureSwitch::extension_action_redesign(), true));
129 BrowserActionsContainer::disable_animations_during_testing_ = true;
130 WrenchToolbarButton::g_open_wrench_immediately_for_testing = true;
128 } 131 }
129 132
130 void ToolbarViewInteractiveUITest::SetUpOnMainThread() { 133 void ToolbarViewInteractiveUITest::SetUpOnMainThread() {
131 ExtensionBrowserTest::SetUpOnMainThread(); 134 ExtensionBrowserTest::SetUpOnMainThread();
132 135
133 toolbar_view_ = BrowserView::GetBrowserViewForBrowser(browser())->toolbar(); 136 toolbar_view_ = BrowserView::GetBrowserViewForBrowser(browser())->toolbar();
134 browser_actions_ = toolbar_view_->browser_actions(); 137 browser_actions_ = toolbar_view_->browser_actions();
135 } 138 }
136 139
140 void ToolbarViewInteractiveUITest::TearDownOnMainThread() {
141 BrowserActionsContainer::disable_animations_during_testing_ = false;
142 WrenchToolbarButton::g_open_wrench_immediately_for_testing = false;
143 }
144
137 IN_PROC_BROWSER_TEST_F(ToolbarViewInteractiveUITest, 145 IN_PROC_BROWSER_TEST_F(ToolbarViewInteractiveUITest,
138 MAYBE(TestWrenchMenuOpensOnDrag)) { 146 MAYBE(TestWrenchMenuOpensOnDrag)) {
139 BrowserActionsContainer::disable_animations_during_testing_ = true;
140 WrenchToolbarButton::g_open_wrench_immediately_for_testing = true;
141
142 // Load an extension that has a browser action. 147 // Load an extension that has a browser action.
143 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("api_test") 148 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("api_test")
144 .AppendASCII("browser_action") 149 .AppendASCII("browser_action")
145 .AppendASCII("basics"))); 150 .AppendASCII("basics")));
146 base::RunLoop().RunUntilIdle(); // Ensure the extension is fully loaded. 151 base::RunLoop().RunUntilIdle(); // Ensure the extension is fully loaded.
147 152
148 ASSERT_EQ(1u, browser_actions()->VisibleBrowserActions()); 153 ASSERT_EQ(1u, browser_actions()->VisibleBrowserActions());
149 154
150 BrowserActionView* view = browser_actions()->GetBrowserActionViewAt(0); 155 BrowserActionView* view = browser_actions()->GetBrowserActionViewAt(0);
151 ASSERT_TRUE(view); 156 ASSERT_TRUE(view);
152 157
153 gfx::Point browser_action_view_loc = test::GetCenterInScreenCoordinates(view); 158 gfx::Point browser_action_view_loc = test::GetCenterInScreenCoordinates(view);
154 gfx::Point wrench_button_loc = 159 gfx::Point wrench_button_loc =
155 test::GetCenterInScreenCoordinates(toolbar_view()->app_menu()); 160 test::GetCenterInScreenCoordinates(toolbar_view()->app_menu());
156 161
157 // 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,
158 // which should open the wrench menu. 163 // which should open the wrench menu.
159 DoDragAndDrop(browser_action_view_loc, wrench_button_loc); 164 DoDragAndDrop(browser_action_view_loc, wrench_button_loc);
160 } 165 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698