OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/bubble/bubble_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 EXPECT_EQ(kArrow, frame.bubble_border()->arrow()); | 130 EXPECT_EQ(kArrow, frame.bubble_border()->arrow()); |
131 EXPECT_EQ(kColor, frame.bubble_border()->background_color()); | 131 EXPECT_EQ(kColor, frame.bubble_border()->background_color()); |
132 | 132 |
133 int margin_x = frame.content_margins().left(); | 133 int margin_x = frame.content_margins().left(); |
134 int margin_y = frame.content_margins().top(); | 134 int margin_y = frame.content_margins().top(); |
135 gfx::Insets insets = frame.bubble_border()->GetInsets(); | 135 gfx::Insets insets = frame.bubble_border()->GetInsets(); |
136 EXPECT_EQ(insets.left() + margin_x, frame.GetBoundsForClientView().x()); | 136 EXPECT_EQ(insets.left() + margin_x, frame.GetBoundsForClientView().x()); |
137 EXPECT_EQ(insets.top() + margin_y, frame.GetBoundsForClientView().y()); | 137 EXPECT_EQ(insets.top() + margin_y, frame.GetBoundsForClientView().y()); |
138 } | 138 } |
139 | 139 |
| 140 TEST_F(BubbleFrameViewTest, RemoveFootnoteView) { |
| 141 TestBubbleFrameView frame(this); |
| 142 EXPECT_EQ(nullptr, frame.footnote_container_); |
| 143 View* footnote_dummy_view = new StaticSizedView(gfx::Size(200, 200)); |
| 144 frame.SetFootnoteView(footnote_dummy_view); |
| 145 EXPECT_EQ(footnote_dummy_view->parent(), frame.footnote_container_); |
| 146 View* container_view = footnote_dummy_view->parent(); |
| 147 delete footnote_dummy_view; |
| 148 footnote_dummy_view = nullptr; |
| 149 EXPECT_FALSE(container_view->visible()); |
| 150 EXPECT_EQ(nullptr, frame.footnote_container_); |
| 151 } |
| 152 |
140 TEST_F(BubbleFrameViewTest, GetBoundsForClientViewWithClose) { | 153 TEST_F(BubbleFrameViewTest, GetBoundsForClientViewWithClose) { |
141 TestBubbleFrameView frame(this); | 154 TestBubbleFrameView frame(this); |
142 // TestBubbleFrameView::GetWidget() is responsible for creating the widget and | 155 // TestBubbleFrameView::GetWidget() is responsible for creating the widget and |
143 // widget delegate at first call, so it is called here for that side-effect. | 156 // widget delegate at first call, so it is called here for that side-effect. |
144 ignore_result(frame.GetWidget()); | 157 ignore_result(frame.GetWidget()); |
145 frame.widget_delegate()->SetShouldShowCloseButton(true); | 158 frame.widget_delegate()->SetShouldShowCloseButton(true); |
146 frame.ResetWindowControls(); | 159 frame.ResetWindowControls(); |
147 EXPECT_EQ(kArrow, frame.bubble_border()->arrow()); | 160 EXPECT_EQ(kArrow, frame.bubble_border()->arrow()); |
148 EXPECT_EQ(kColor, frame.bubble_border()->background_color()); | 161 EXPECT_EQ(kColor, frame.bubble_border()->background_color()); |
149 | 162 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 // If the DialogDelegate asks not to snap, it should not snap. | 572 // If the DialogDelegate asks not to snap, it should not snap. |
560 delegate.set_override_snap(false); | 573 delegate.set_override_snap(false); |
561 Widget* w2 = BubbleDialogDelegateView::CreateBubble(&delegate); | 574 Widget* w2 = BubbleDialogDelegateView::CreateBubble(&delegate); |
562 w2->Show(); | 575 w2->Show(); |
563 EXPECT_EQ(delegate.GetPreferredSize().width(), | 576 EXPECT_EQ(delegate.GetPreferredSize().width(), |
564 w2->GetWindowBoundsInScreen().width()); | 577 w2->GetWindowBoundsInScreen().width()); |
565 w2->CloseNow(); | 578 w2->CloseNow(); |
566 } | 579 } |
567 | 580 |
568 } // namespace views | 581 } // namespace views |
OLD | NEW |