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

Unified Diff: ui/views/bubble/bubble_frame_view_unittest.cc

Issue 2863923002: Harmony: Don't snap the width of the chrome:// page info bubbles. (Closed)
Patch Set: Add a test whynot Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/bubble/bubble_frame_view.cc ('k') | ui/views/window/dialog_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/bubble_frame_view_unittest.cc
diff --git a/ui/views/bubble/bubble_frame_view_unittest.cc b/ui/views/bubble/bubble_frame_view_unittest.cc
index 705e17744288dfde2b1d9c7989577266a0c4e3ee..0604af76a432f8f4737806e29448b474b789a2c0 100644
--- a/ui/views/bubble/bubble_frame_view_unittest.cc
+++ b/ui/views/bubble/bubble_frame_view_unittest.cc
@@ -502,17 +502,23 @@ class TestBubbleDialogDelegateView : public BubbleDialogDelegateView {
using BubbleDialogDelegateView::SetAnchorView;
+ void set_override_snap(bool value) { override_snap_ = value; }
+
// BubbleDialogDelegateView:
void DeleteDelegate() override {
// This delegate is owned by the test case itself, so it should not delete
// itself here.
}
-
int GetDialogButtons() const override { return ui::DIALOG_BUTTON_NONE; }
-
+ bool ShouldSnapFrameWidth() const override {
+ return override_snap_.value_or(
+ BubbleDialogDelegateView::ShouldSnapFrameWidth());
+ }
gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); }
private:
+ base::Optional<bool> override_snap_;
+
DISALLOW_COPY_AND_ASSIGN(TestBubbleDialogDelegateView);
};
@@ -566,6 +572,14 @@ TEST_F(BubbleFrameViewTest, WidthSnaps) {
w1->Show();
EXPECT_EQ(kTestWidth, w1->GetWindowBoundsInScreen().width());
w1->CloseNow();
+
+ // If the DialogDelegate asks not to snap, it should not snap.
+ delegate.set_override_snap(false);
+ Widget* w2 = BubbleDialogDelegateView::CreateBubble(&delegate);
+ w2->Show();
+ EXPECT_EQ(delegate.GetPreferredSize().width(),
+ w2->GetWindowBoundsInScreen().width());
+ w2->CloseNow();
}
} // namespace views
« no previous file with comments | « ui/views/bubble/bubble_frame_view.cc ('k') | ui/views/window/dialog_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698