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

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

Issue 1858773006: [Extensions UI] Use the ExtensionMessageBubbleBridge for Views platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.h" 7 #include "chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.h"
8 #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h" 8 #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/events/test/event_generator.h" 10 #include "ui/events/test/event_generator.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 EXPECT_FALSE(delegate.close_action()); 150 EXPECT_FALSE(delegate.close_action());
151 // Close the bubble by activating another widget. The delegate should be 151 // Close the bubble by activating another widget. The delegate should be
152 // told it was dismissed. 152 // told it was dismissed.
153 anchor_widget->Activate(); 153 anchor_widget->Activate();
154 base::RunLoop().RunUntilIdle(); 154 base::RunLoop().RunUntilIdle();
155 ASSERT_TRUE(delegate.close_action()); 155 ASSERT_TRUE(delegate.close_action());
156 EXPECT_EQ(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION, 156 EXPECT_EQ(ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION,
157 *delegate.close_action()); 157 *delegate.close_action());
158 EXPECT_TRUE(bubble_observer.widget_closed()); 158 EXPECT_TRUE(bubble_observer.widget_closed());
159 } 159 }
160
161 TEST_F(ToolbarActionsBarBubbleViewsTest, TestDontCloseOnDeactivation) {
162 scoped_ptr<views::Widget> anchor_widget = CreateAnchorWidget();
163 TestToolbarActionsBarBubbleDelegate delegate(HeadingString(), BodyString(),
164 ActionString());
165 delegate.set_dismiss_button_text(DismissString());
166 delegate.set_close_on_deactivate(false);
167 ToolbarActionsBarBubbleViews* bubble = new ToolbarActionsBarBubbleViews(
168 anchor_widget->GetContentsView(), delegate.GetDelegate());
169 views::Widget* bubble_widget =
170 views::BubbleDelegateView::CreateBubble(bubble);
171 views::test::TestWidgetObserver bubble_observer(bubble_widget);
172 bubble->Show();
173
174 EXPECT_FALSE(delegate.close_action());
175 // Activate another widget. The bubble shouldn't close.
176 anchor_widget->Activate();
177 base::RunLoop().RunUntilIdle();
178 EXPECT_FALSE(delegate.close_action());
179 bubble_widget->Close();
180 base::RunLoop().RunUntilIdle();
181 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698