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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_message_bubble_view_browsertest.cc

Issue 2827603005: Cater for the "double close" when clicking "Learn More" on auto-dismiss extension bubbles. (Closed)
Patch Set: resilience Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/auto_reset.h" 5 #include "base/auto_reset.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h" 7 #include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h"
8 #include "chrome/browser/ui/test/test_browser_dialog.h" 8 #include "chrome/browser/ui/test/test_browser_dialog.h"
9 #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h" 9 #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h"
10 #include "ui/accessibility/ax_node_data.h" 10 #include "ui/accessibility/ax_node_data.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 base::CommandLine* command_line) { 85 base::CommandLine* command_line) {
86 ExtensionMessageBubbleBrowserTest::SetUpCommandLine(command_line); 86 ExtensionMessageBubbleBrowserTest::SetUpCommandLine(command_line);
87 // MD is required on Mac to get a Views bubble. On other platforms, it should 87 // MD is required on Mac to get a Views bubble. On other platforms, it should
88 // not affect the behavior of the bubble (just the appearance), so enable for 88 // not affect the behavior of the bubble (just the appearance), so enable for
89 // all platforms. 89 // all platforms.
90 command_line->AppendSwitch(switches::kExtendMdToSecondaryUi); 90 command_line->AppendSwitch(switches::kExtendMdToSecondaryUi);
91 } 91 }
92 92
93 void ExtensionMessageBubbleViewBrowserTest::ShowDialog( 93 void ExtensionMessageBubbleViewBrowserTest::ShowDialog(
94 const std::string& name) { 94 const std::string& name) {
95 // TODO(tapted): Add cases for all bubble types.
96 EXPECT_EQ("devmode_warning", name);
97
98 // When invoked this way, the dialog test harness must close the bubble. 95 // When invoked this way, the dialog test harness must close the bubble.
99 base::AutoReset<bool> guard(&block_close_, true); 96 base::AutoReset<bool> guard(&block_close_, true);
100 TestBubbleAnchoredToExtensionAction(); 97
98 if (name == "devmode_warning") {
99 TestBubbleAnchoredToExtensionAction();
100 } else if (name == "ntp_override") {
101 TestControlledNewTabPageBubbleShown(false);
102 } else {
103 // TODO(tapted): Add cases for all bubble types.
104 ADD_FAILURE() << "Unknown dialog: " << name;
105 }
101 } 106 }
102 107
103 void ExtensionMessageBubbleViewBrowserTest::CheckBubbleNative( 108 void ExtensionMessageBubbleViewBrowserTest::CheckBubbleNative(
104 Browser* browser, 109 Browser* browser,
105 AnchorPosition anchor) { 110 AnchorPosition anchor) {
106 gfx::Rect reference_bounds = 111 gfx::Rect reference_bounds =
107 GetAnchorReferenceBoundsForBrowser(browser, anchor); 112 GetAnchorReferenceBoundsForBrowser(browser, anchor);
108 CheckBubbleAgainstReferenceBounds(GetViewsBubbleForBrowser(browser), 113 CheckBubbleAgainstReferenceBounds(GetViewsBubbleForBrowser(browser),
109 reference_bounds); 114 reference_bounds);
110 } 115 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 191 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
187 TestDevModeBubbleIsntShownTwice) { 192 TestDevModeBubbleIsntShownTwice) {
188 TestDevModeBubbleIsntShownTwice(); 193 TestDevModeBubbleIsntShownTwice();
189 } 194 }
190 195
191 // Tests for the extension bubble and settings overrides. These bubbles are 196 // Tests for the extension bubble and settings overrides. These bubbles are
192 // currently only shown on Windows. 197 // currently only shown on Windows.
193 #if defined(OS_WIN) 198 #if defined(OS_WIN)
194 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 199 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
195 TestControlledNewTabPageMessageBubble) { 200 TestControlledNewTabPageMessageBubble) {
196 TestControlledNewTabPageBubbleShown(); 201 TestControlledNewTabPageBubbleShown(false);
197 } 202 }
198 203
199 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 204 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
205 TestControlledNewTabPageMessageBubbleLearnMore) {
206 TestControlledNewTabPageBubbleShown(true);
207 }
208
209 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
200 TestControlledHomeMessageBubble) { 210 TestControlledHomeMessageBubble) {
201 TestControlledHomeBubbleShown(); 211 TestControlledHomeBubbleShown();
202 } 212 }
203 213
204 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 214 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
205 TestControlledSearchMessageBubble) { 215 TestControlledSearchMessageBubble) {
206 TestControlledSearchBubbleShown(); 216 TestControlledSearchBubbleShown();
207 } 217 }
208 218
209 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 219 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
210 PRE_TestControlledStartupMessageBubble) { 220 PRE_TestControlledStartupMessageBubble) {
211 PreTestControlledStartupBubbleShown(); 221 PreTestControlledStartupBubbleShown();
212 } 222 }
213 223
214 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 224 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
215 TestControlledStartupMessageBubble) { 225 TestControlledStartupMessageBubble) {
216 TestControlledStartupBubbleShown(); 226 TestControlledStartupBubbleShown();
217 } 227 }
218 228
219 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 229 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
220 PRE_TestControlledStartupNotShownOnRestart) { 230 PRE_TestControlledStartupNotShownOnRestart) {
221 PreTestControlledStartupNotShownOnRestart(); 231 PreTestControlledStartupNotShownOnRestart();
222 } 232 }
223 233
224 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 234 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
225 TestControlledStartupNotShownOnRestart) { 235 TestControlledStartupNotShownOnRestart) {
226 TestControlledStartupNotShownOnRestart(); 236 TestControlledStartupNotShownOnRestart();
227 } 237 }
228 238
239 // BrowserDialogTest for the warning bubble that appears when opening a new tab
240 // and an extension is controlling it. Only shown on Windows.
241 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
242 InvokeDialog_ntp_override) {
243 RunDialog();
244 }
245
229 #endif // defined(OS_WIN) 246 #endif // defined(OS_WIN)
230 247
231 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 248 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
232 TestBubbleWithMultipleWindows) { 249 TestBubbleWithMultipleWindows) {
233 TestBubbleWithMultipleWindows(); 250 TestBubbleWithMultipleWindows();
234 } 251 }
235 252
236 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 253 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
237 TestClickingLearnMoreButton) { 254 TestClickingLearnMoreButton) {
238 TestClickingLearnMoreButton(); 255 TestClickingLearnMoreButton();
239 } 256 }
240 257
241 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 258 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
242 TestClickingActionButton) { 259 TestClickingActionButton) {
243 TestClickingActionButton(); 260 TestClickingActionButton();
244 } 261 }
245 262
246 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 263 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
247 TestClickingDismissButton) { 264 TestClickingDismissButton) {
248 TestClickingDismissButton(); 265 TestClickingDismissButton();
249 } 266 }
250 267
251 // BrowserDialogTest for the warning bubble that appears at startup when there 268 // BrowserDialogTest for the warning bubble that appears at startup when there
252 // are extensions installed in developer mode. Can be invoked interactively with 269 // are extensions installed in developer mode. Can be invoked interactively with
253 // --gtest_filter=BrowserDialogTest.Invoke. 270 // --gtest_filter=BrowserDialogTest.Invoke.
254 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 271 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
255 InvokeDialog_devmode_warning) { 272 InvokeDialog_devmode_warning) {
256 RunDialog(); 273 RunDialog();
257 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698