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

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

Issue 2825243002: DialogClientView: Handle nested close requests gracefully.
Patch Set: Self review 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
« no previous file with comments | « no previous file | ui/views/window/dialog_client_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 224 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
220 PRE_TestControlledStartupNotShownOnRestart) { 225 PRE_TestControlledStartupNotShownOnRestart) {
221 PreTestControlledStartupNotShownOnRestart(); 226 PreTestControlledStartupNotShownOnRestart();
222 } 227 }
223 228
224 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 229 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
225 TestControlledStartupNotShownOnRestart) { 230 TestControlledStartupNotShownOnRestart) {
226 TestControlledStartupNotShownOnRestart(); 231 TestControlledStartupNotShownOnRestart();
227 } 232 }
228 233
234 // BrowserDialogTest for the warning bubble that appears when opening a new tab
235 // and an extension is controlling it. Only shown on Windows.
236 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
237 InvokeDialog_ntp_override) {
238 RunDialog();
239 }
240
229 #endif // defined(OS_WIN) 241 #endif // defined(OS_WIN)
230 242
231 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 243 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
232 TestBubbleWithMultipleWindows) { 244 TestBubbleWithMultipleWindows) {
233 TestBubbleWithMultipleWindows(); 245 TestBubbleWithMultipleWindows();
234 } 246 }
235 247
236 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 248 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
237 TestClickingLearnMoreButton) { 249 TestClickingLearnMoreButton) {
238 TestClickingLearnMoreButton(); 250 TestClickingLearnMoreButton();
239 } 251 }
240 252
241 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 253 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
242 TestClickingActionButton) { 254 TestClickingActionButton) {
243 TestClickingActionButton(); 255 TestClickingActionButton();
244 } 256 }
245 257
246 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 258 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
247 TestClickingDismissButton) { 259 TestClickingDismissButton) {
248 TestClickingDismissButton(); 260 TestClickingDismissButton();
249 } 261 }
250 262
251 // BrowserDialogTest for the warning bubble that appears at startup when there 263 // BrowserDialogTest for the warning bubble that appears at startup when there
252 // are extensions installed in developer mode. Can be invoked interactively with 264 // are extensions installed in developer mode. Can be invoked interactively with
253 // --gtest_filter=BrowserDialogTest.Invoke. 265 // --gtest_filter=BrowserDialogTest.Invoke.
254 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 266 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
255 InvokeDialog_devmode_warning) { 267 InvokeDialog_devmode_warning) {
256 RunDialog(); 268 RunDialog();
257 } 269 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/window/dialog_client_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698