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

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

Issue 2762893002: Fix a lifetime issue in ToolbarActionsBarBubbleViews (Closed)
Patch Set: Update comment Created 3 years, 9 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/base/ui_base_switches.h" 11 #include "ui/base/ui_base_switches.h"
11 #include "ui/views/bubble/bubble_dialog_delegate.h" 12 #include "ui/views/bubble/bubble_dialog_delegate.h"
12 #include "ui/views/controls/link.h" 13 #include "ui/views/controls/link.h"
13 #include "ui/views/controls/link_listener.h" 14 #include "ui/views/controls/link_listener.h"
14 #include "ui/views/window/dialog_client_view.h" 15 #include "ui/views/window/dialog_client_view.h"
15 16
16 namespace { 17 namespace {
17 18
18 // Checks that the |bubble| is showing. Uses |reference_bounds| to ensure it is 19 // Checks that the |bubble| is showing. Uses |reference_bounds| to ensure it is
19 // in approximately the correct position. 20 // in approximately the correct position.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void ExtensionMessageBubbleViewBrowserTest::CheckBubbleIsNotPresentNative( 125 void ExtensionMessageBubbleViewBrowserTest::CheckBubbleIsNotPresentNative(
125 Browser* browser) { 126 Browser* browser) {
126 EXPECT_EQ(nullptr, GetViewsBubbleForBrowser(browser)); 127 EXPECT_EQ(nullptr, GetViewsBubbleForBrowser(browser));
127 } 128 }
128 129
129 void ExtensionMessageBubbleViewBrowserTest::ClickLearnMoreButton( 130 void ExtensionMessageBubbleViewBrowserTest::ClickLearnMoreButton(
130 Browser* browser) { 131 Browser* browser) {
131 ToolbarActionsBarBubbleViews* bubble = GetViewsBubbleForBrowser(browser); 132 ToolbarActionsBarBubbleViews* bubble = GetViewsBubbleForBrowser(browser);
132 static_cast<views::LinkListener*>(bubble)->LinkClicked( 133 static_cast<views::LinkListener*>(bubble)->LinkClicked(
133 const_cast<views::Link*>(bubble->learn_more_button()), 0); 134 const_cast<views::Link*>(bubble->learn_more_button()), 0);
135
136 // Clicking a button closes asynchronously. Since the close is asynchronous,
137 // platform events may happen before the close completes and the dialog needs
138 // to report a valid state.
139 ui::AXNodeData node_data;
140 bubble->GetAccessibleNodeData(&node_data);
141 EXPECT_EQ(ui::AX_ROLE_DIALOG, node_data.role);
134 } 142 }
135 143
136 void ExtensionMessageBubbleViewBrowserTest::ClickActionButton( 144 void ExtensionMessageBubbleViewBrowserTest::ClickActionButton(
137 Browser* browser) { 145 Browser* browser) {
138 ToolbarActionsBarBubbleViews* bubble = GetViewsBubbleForBrowser(browser); 146 ToolbarActionsBarBubbleViews* bubble = GetViewsBubbleForBrowser(browser);
139 bubble->GetDialogClientView()->AcceptWindow(); 147 bubble->GetDialogClientView()->AcceptWindow();
140 } 148 }
141 149
142 void ExtensionMessageBubbleViewBrowserTest::ClickDismissButton( 150 void ExtensionMessageBubbleViewBrowserTest::ClickDismissButton(
143 Browser* browser) { 151 Browser* browser) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 TestControlledStartupNotShownOnRestart(); 226 TestControlledStartupNotShownOnRestart();
219 } 227 }
220 228
221 #endif // defined(OS_WIN) 229 #endif // defined(OS_WIN)
222 230
223 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 231 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
224 TestBubbleWithMultipleWindows) { 232 TestBubbleWithMultipleWindows) {
225 TestBubbleWithMultipleWindows(); 233 TestBubbleWithMultipleWindows();
226 } 234 }
227 235
228 // Crashes on Mac only. http://crbug.com/702554
229 #if defined(OS_MACOSX)
230 #define MAYBE_TestClickingLearnMoreButton DISABLED_TestClickingLearnMoreButton
231 #else
232 #define MAYBE_TestClickingLearnMoreButton TestClickingLearnMoreButton
233 #endif
234 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 236 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
235 MAYBE_TestClickingLearnMoreButton) { 237 TestClickingLearnMoreButton) {
236 TestClickingLearnMoreButton(); 238 TestClickingLearnMoreButton();
237 } 239 }
238 240
239 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 241 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
240 TestClickingActionButton) { 242 TestClickingActionButton) {
241 TestClickingActionButton(); 243 TestClickingActionButton();
242 } 244 }
243 245
244 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 246 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
245 TestClickingDismissButton) { 247 TestClickingDismissButton) {
246 TestClickingDismissButton(); 248 TestClickingDismissButton();
247 } 249 }
248 250
249 // BrowserDialogTest for the warning bubble that appears at startup when there 251 // BrowserDialogTest for the warning bubble that appears at startup when there
250 // are extensions installed in developer mode. Can be invoked interactively with 252 // are extensions installed in developer mode. Can be invoked interactively with
251 // --gtest_filter=BrowserDialogTest.Invoke. 253 // --gtest_filter=BrowserDialogTest.Invoke.
252 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest, 254 IN_PROC_BROWSER_TEST_F(ExtensionMessageBubbleViewBrowserTest,
253 InvokeDialog_devmode_warning) { 255 InvokeDialog_devmode_warning) {
254 RunDialog(); 256 RunDialog();
255 } 257 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698