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

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

Issue 10808066: Fix position of web notification bubble and arrow (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 8 years, 5 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 d4f5e0536532401b405678a8bf5d4d8878ecbd17..c6f1a5b2cf72bf048f8d8ad9d7abacd4b847ce30 100644
--- a/ui/views/bubble/bubble_frame_view_unittest.cc
+++ b/ui/views/bubble/bubble_frame_view_unittest.cc
@@ -44,7 +44,7 @@ gfx::Size SizedBubbleDelegateView::GetPreferredSize() {
class TestBubbleFrameView : public BubbleFrameView {
public:
- explicit TestBubbleFrameView(const gfx::Rect& bounds);
+ TestBubbleFrameView();
virtual ~TestBubbleFrameView();
protected:
@@ -56,13 +56,14 @@ class TestBubbleFrameView : public BubbleFrameView {
DISALLOW_COPY_AND_ASSIGN(TestBubbleFrameView);
};
-TestBubbleFrameView::TestBubbleFrameView(const gfx::Rect& bounds)
- : BubbleFrameView(kArrow, kBackgroundColor,
- gfx::Insets(kDefaultMargin,
- kDefaultMargin,
- kDefaultMargin,
- kDefaultMargin)),
- monitor_bounds_(bounds) {
+TestBubbleFrameView::TestBubbleFrameView()
+ : BubbleFrameView(gfx::Insets(kDefaultMargin,
+ kDefaultMargin,
+ kDefaultMargin,
+ kDefaultMargin),
+ new BubbleBorder(kArrow, BubbleBorder::NO_SHADOW)),
+ monitor_bounds_(gfx::Rect(0, 0, 1000, 1000)) {
+ bubble_border()->set_background_color(kBackgroundColor);
}
TestBubbleFrameView::~TestBubbleFrameView() {}
@@ -74,11 +75,7 @@ gfx::Rect TestBubbleFrameView::GetMonitorBounds(const gfx::Rect& rect) {
} // namespace
TEST_F(BubbleFrameViewTest, GetBoundsForClientView) {
- BubbleFrameView frame(
- kArrow,
- kBackgroundColor,
- gfx::Insets(kDefaultMargin, kDefaultMargin, kDefaultMargin,
- kDefaultMargin));
+ TestBubbleFrameView frame;
EXPECT_EQ(kArrow, frame.bubble_border()->arrow_location());
EXPECT_EQ(kBackgroundColor, frame.bubble_border()->background_color());
@@ -105,7 +102,7 @@ TEST_F(BubbleFrameViewTest, NonClientHitTest) {
// Tests that the arrow is mirrored as needed to better fit the screen.
TEST_F(BubbleFrameViewTest, GetUpdatedWindowBounds) {
- TestBubbleFrameView frame(gfx::Rect(0, 0, 1000, 1000));
+ TestBubbleFrameView frame;
gfx::Rect window_bounds;
gfx::Insets insets;
@@ -218,7 +215,7 @@ TEST_F(BubbleFrameViewTest, GetUpdatedWindowBounds) {
// Tests that the arrow is not moved when the info-bubble does not fit the
// screen but moving it would make matter worse.
TEST_F(BubbleFrameViewTest, GetUpdatedWindowBoundsMirroringFails) {
- TestBubbleFrameView frame(gfx::Rect(0, 0, 1000, 1000));
+ TestBubbleFrameView frame;
frame.bubble_border()->set_arrow_location(BubbleBorder::TOP_LEFT);
gfx::Rect window_bounds = frame.GetUpdatedWindowBounds(
gfx::Rect(400, 100, 50, 50), // |anchor_rect|
@@ -229,7 +226,7 @@ TEST_F(BubbleFrameViewTest, GetUpdatedWindowBoundsMirroringFails) {
// Test that the arrow will not be mirrored when |try_mirroring_arrow| is false.
TEST_F(BubbleFrameViewTest, GetUpdatedWindowBoundsDontTryMirror) {
- TestBubbleFrameView frame(gfx::Rect(0, 0, 1000, 1000));
+ TestBubbleFrameView frame;
frame.bubble_border()->set_arrow_location(BubbleBorder::TOP_RIGHT);
gfx::Rect window_bounds = frame.GetUpdatedWindowBounds(
gfx::Rect(100, 900, 50, 50), // |anchor_rect|
« 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