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

Side by Side Diff: ui/views/bubble/bubble_delegate_unittest.cc

Issue 677413004: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « ui/views/bubble/bubble_delegate.h ('k') | ui/views/bubble/bubble_frame_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "ui/views/widget/widget_observer.h" 11 #include "ui/views/widget/widget_observer.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 namespace { 15 namespace {
16 16
17 class TestBubbleDelegateView : public BubbleDelegateView { 17 class TestBubbleDelegateView : public BubbleDelegateView {
18 public: 18 public:
19 TestBubbleDelegateView(View* anchor_view) 19 TestBubbleDelegateView(View* anchor_view)
20 : BubbleDelegateView(anchor_view, BubbleBorder::TOP_LEFT), 20 : BubbleDelegateView(anchor_view, BubbleBorder::TOP_LEFT),
21 view_(new View()) { 21 view_(new View()) {
22 view_->SetFocusable(true); 22 view_->SetFocusable(true);
23 AddChildView(view_); 23 AddChildView(view_);
24 } 24 }
25 virtual ~TestBubbleDelegateView() {} 25 ~TestBubbleDelegateView() override {}
26 26
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 View* GetInitiallyFocusedView() override { return view_; }
37 virtual gfx::Size GetPreferredSize() const override { 37 gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); }
38 return gfx::Size(200, 200);
39 }
40 38
41 private: 39 private:
42 View* view_; 40 View* view_;
43 41
44 DISALLOW_COPY_AND_ASSIGN(TestBubbleDelegateView); 42 DISALLOW_COPY_AND_ASSIGN(TestBubbleDelegateView);
45 }; 43 };
46 44
47 class BubbleDelegateTest : public ViewsTestBase { 45 class BubbleDelegateTest : public ViewsTestBase {
48 public: 46 public:
49 BubbleDelegateTest() {} 47 BubbleDelegateTest() {}
50 virtual ~BubbleDelegateTest() {} 48 ~BubbleDelegateTest() override {}
51 49
52 // Creates a test widget that owns its native widget. 50 // Creates a test widget that owns its native widget.
53 Widget* CreateTestWidget() { 51 Widget* CreateTestWidget() {
54 Widget* widget = new Widget(); 52 Widget* widget = new Widget();
55 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); 53 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
56 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 54 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
57 widget->Init(params); 55 widget->Init(params);
58 return widget; 56 return widget;
59 } 57 }
60 58
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 scoped_ptr<Widget> anchor_widget(CreateTestWidget()); 254 scoped_ptr<Widget> anchor_widget(CreateTestWidget());
257 BubbleDelegateView* bubble_delegate = new BubbleDelegateView( 255 BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
258 anchor_widget->GetContentsView(), BubbleBorder::NONE); 256 anchor_widget->GetContentsView(), BubbleBorder::NONE);
259 bubble_delegate->set_can_activate(false); 257 bubble_delegate->set_can_activate(false);
260 Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate); 258 Widget* bubble_widget = BubbleDelegateView::CreateBubble(bubble_delegate);
261 bubble_widget->Show(); 259 bubble_widget->Show();
262 EXPECT_FALSE(bubble_widget->CanActivate()); 260 EXPECT_FALSE(bubble_widget->CanActivate());
263 } 261 }
264 262
265 } // namespace views 263 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_delegate.h ('k') | ui/views/bubble/bubble_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698