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

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

Issue 2955963002: Update Chrome Upstream flow to reflect new UI mocks (Closed)
Patch Set: Prevent AddNewUiFlagStateToRequestIfExperimentOn test from running on Android Created 3 years, 4 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') | no next file » | 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 dda52edc8549fa7c161bff9ae03cf6297ea32f42..61066f0ddcb3e40def7454cddfa12a5a608d575e 100644
--- a/ui/views/bubble/bubble_frame_view_unittest.cc
+++ b/ui/views/bubble/bubble_frame_view_unittest.cc
@@ -168,6 +168,20 @@ TEST_F(BubbleFrameViewTest, GetBoundsForClientViewWithClose) {
frame.GetBoundsForClientView().y());
}
+TEST_F(BubbleFrameViewTest,
+ FootnoteContainerViewShouldMatchVisibilityOfFirstChild) {
+ TestBubbleFrameView frame(this);
+ View* footnote_dummy_view = new StaticSizedView(gfx::Size(200, 200));
+ footnote_dummy_view->SetVisible(false);
+ frame.SetFootnoteView(footnote_dummy_view);
+ View* footnote_container_view = footnote_dummy_view->parent();
+ EXPECT_FALSE(footnote_container_view->visible());
+ footnote_dummy_view->SetVisible(true);
+ EXPECT_TRUE(footnote_container_view->visible());
+ footnote_dummy_view->SetVisible(false);
+ EXPECT_FALSE(footnote_container_view->visible());
+}
+
// Tests that the arrow is mirrored as needed to better fit the screen.
TEST_F(BubbleFrameViewTest, GetUpdatedWindowBounds) {
TestBubbleFrameView frame(this);
@@ -465,6 +479,7 @@ TEST_F(BubbleFrameViewTest, GetUpdatedWindowBoundsCenterArrows) {
}
TEST_F(BubbleFrameViewTest, GetPreferredSize) {
+ // Test border/insets.
TestBubbleFrameView frame(this);
gfx::Rect preferred_rect(frame.GetPreferredSize());
// Expect that a border has been added to the preferred size.
@@ -475,6 +490,29 @@ TEST_F(BubbleFrameViewTest, GetPreferredSize) {
EXPECT_EQ(expected_size, preferred_rect.size());
}
+TEST_F(BubbleFrameViewTest, GetPreferredSizeWithFootnote) {
+ // Test footnote view: adding a footnote should increase the preferred size,
+ // but only when the footnote is visible.
+ TestBubbleFrameView frame(this);
+
+ constexpr int kFootnoteHeight = 20;
+ const gfx::Size no_footnote_size = frame.GetPreferredSize();
+ View* footnote = new StaticSizedView(gfx::Size(10, kFootnoteHeight));
+ footnote->SetVisible(false);
+ frame.SetFootnoteView(footnote);
+ EXPECT_EQ(no_footnote_size, frame.GetPreferredSize()); // No change.
+
+ footnote->SetVisible(true);
+ gfx::Size with_footnote_size = no_footnote_size;
+ constexpr int kFootnoteTopBorderThickness = 1;
+ with_footnote_size.Enlarge(0, kFootnoteHeight + kFootnoteTopBorderThickness +
+ frame.content_margins().height());
+ EXPECT_EQ(with_footnote_size, frame.GetPreferredSize());
+
+ footnote->SetVisible(false);
+ EXPECT_EQ(no_footnote_size, frame.GetPreferredSize());
+}
+
TEST_F(BubbleFrameViewTest, GetMinimumSize) {
TestBubbleFrameView frame(this);
gfx::Rect minimum_rect(frame.GetMinimumSize());
« no previous file with comments | « ui/views/bubble/bubble_frame_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698