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/views/bubble/bubble_delegate.h" | 6 #include "ui/views/bubble/bubble_delegate.h" |
7 #include "ui/views/bubble/bubble_frame_view.h" | 7 #include "ui/views/bubble/bubble_frame_view.h" |
8 #include "ui/views/test/test_widget_observer.h" | 8 #include "ui/views/test/test_widget_observer.h" |
9 #include "ui/views/test/views_test_base.h" | 9 #include "ui/views/test/views_test_base.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 void SetAnchorRectForTest(gfx::Rect rect) { | 27 void SetAnchorRectForTest(gfx::Rect rect) { |
28 SetAnchorRect(rect); | 28 SetAnchorRect(rect); |
29 } | 29 } |
30 | 30 |
31 void SetAnchorViewForTest(View* view) { | 31 void SetAnchorViewForTest(View* view) { |
32 SetAnchorView(view); | 32 SetAnchorView(view); |
33 } | 33 } |
34 | 34 |
35 // BubbleDelegateView overrides: | 35 // BubbleDelegateView overrides: |
36 virtual View* GetInitiallyFocusedView() OVERRIDE { return view_; } | 36 virtual View* GetInitiallyFocusedView() OVERRIDE { return view_; } |
37 virtual gfx::Size GetPreferredSize() OVERRIDE { return gfx::Size(200, 200); } | 37 virtual gfx::Size GetPreferredSize() const OVERRIDE { |
| 38 return gfx::Size(200, 200); |
| 39 } |
38 | 40 |
39 private: | 41 private: |
40 View* view_; | 42 View* view_; |
41 | 43 |
42 DISALLOW_COPY_AND_ASSIGN(TestBubbleDelegateView); | 44 DISALLOW_COPY_AND_ASSIGN(TestBubbleDelegateView); |
43 }; | 45 }; |
44 | 46 |
45 class BubbleDelegateTest : public ViewsTestBase { | 47 class BubbleDelegateTest : public ViewsTestBase { |
46 public: | 48 public: |
47 BubbleDelegateTest() {} | 49 BubbleDelegateTest() {} |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 test::TestWidgetObserver bubble_observer(bubble_widget); | 244 test::TestWidgetObserver bubble_observer(bubble_widget); |
243 EXPECT_FALSE(bubble_observer.widget_closed()); | 245 EXPECT_FALSE(bubble_observer.widget_closed()); |
244 | 246 |
245 bubble_widget->Show(); | 247 bubble_widget->Show(); |
246 EXPECT_TRUE(bubble_widget->IsVisible()); | 248 EXPECT_TRUE(bubble_widget->IsVisible()); |
247 anchor_widget->SetBounds(gfx::Rect(10, 10, 100, 100)); | 249 anchor_widget->SetBounds(gfx::Rect(10, 10, 100, 100)); |
248 EXPECT_TRUE(bubble_widget->IsVisible()); | 250 EXPECT_TRUE(bubble_widget->IsVisible()); |
249 } | 251 } |
250 | 252 |
251 } // namespace views | 253 } // namespace views |
OLD | NEW |