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/base/hit_test.h" | 5 #include "ui/base/hit_test.h" |
6 #include "ui/gfx/insets.h" | 6 #include "ui/gfx/insets.h" |
7 #include "ui/views/bubble/bubble_border.h" | 7 #include "ui/views/bubble/bubble_border.h" |
8 #include "ui/views/bubble/bubble_delegate.h" | 8 #include "ui/views/bubble/bubble_delegate.h" |
9 #include "ui/views/bubble/bubble_frame_view.h" | 9 #include "ui/views/bubble/bubble_frame_view.h" |
10 #include "ui/views/test/views_test_base.h" | 10 #include "ui/views/test/views_test_base.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Create the anchor and parent widgets. | 88 // Create the anchor and parent widgets. |
89 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); | 89 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); |
90 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 90 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
91 scoped_ptr<Widget> anchor_widget(new Widget); | 91 scoped_ptr<Widget> anchor_widget(new Widget); |
92 anchor_widget->Init(params); | 92 anchor_widget->Init(params); |
93 anchor_widget->Show(); | 93 anchor_widget->Show(); |
94 | 94 |
95 BubbleDelegateView* delegate = | 95 BubbleDelegateView* delegate = |
96 new SizedBubbleDelegateView(anchor_widget->GetContentsView()); | 96 new SizedBubbleDelegateView(anchor_widget->GetContentsView()); |
97 Widget* widget(BubbleDelegateView::CreateBubble(delegate)); | 97 Widget* widget(BubbleDelegateView::CreateBubble(delegate)); |
98 delegate->Show(); | 98 widget->Show(); |
99 gfx::Point kPtInBound(100, 100); | 99 gfx::Point kPtInBound(100, 100); |
100 gfx::Point kPtOutsideBound(1000, 1000); | 100 gfx::Point kPtOutsideBound(1000, 1000); |
101 BubbleFrameView* bubble_frame_view = delegate->GetBubbleFrameView(); | 101 BubbleFrameView* bubble_frame_view = delegate->GetBubbleFrameView(); |
102 EXPECT_EQ(HTCLIENT, bubble_frame_view->NonClientHitTest(kPtInBound)); | 102 EXPECT_EQ(HTCLIENT, bubble_frame_view->NonClientHitTest(kPtInBound)); |
103 EXPECT_EQ(HTNOWHERE, bubble_frame_view->NonClientHitTest(kPtOutsideBound)); | 103 EXPECT_EQ(HTNOWHERE, bubble_frame_view->NonClientHitTest(kPtOutsideBound)); |
104 widget->CloseNow(); | 104 widget->CloseNow(); |
105 RunPendingMessages(); | 105 RunPendingMessages(); |
106 } | 106 } |
107 | 107 |
108 // Tests that the arrow is mirrored as needed to better fit the screen. | 108 // Tests that the arrow is mirrored as needed to better fit the screen. |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 gfx::Size(500, 500), // |client_size| | 404 gfx::Size(500, 500), // |client_size| |
405 true); // |adjust_if_offscreen| | 405 true); // |adjust_if_offscreen| |
406 EXPECT_EQ(BubbleBorder::RIGHT_CENTER, | 406 EXPECT_EQ(BubbleBorder::RIGHT_CENTER, |
407 frame.bubble_border()->arrow_location()); | 407 frame.bubble_border()->arrow_location()); |
408 EXPECT_EQ(window_bounds.bottom(), 1000); | 408 EXPECT_EQ(window_bounds.bottom(), 1000); |
409 EXPECT_EQ(window_bounds.y() + | 409 EXPECT_EQ(window_bounds.y() + |
410 frame.bubble_border()->GetArrowOffset(window_bounds.size()), 925); | 410 frame.bubble_border()->GetArrowOffset(window_bounds.size()), 925); |
411 } | 411 } |
412 | 412 |
413 } // namespace views | 413 } // namespace views |
OLD | NEW |