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

Side by Side Diff: ash/frame/custom_frame_view_ash_unittest.cc

Issue 683593003: 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 | « ash/frame/custom_frame_view_ash.cc ('k') | ash/frame/default_header_painter.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/frame/custom_frame_view_ash.h" 5 #include "ash/frame/custom_frame_view_ash.h"
6 6
7 #include "ash/frame/caption_buttons/frame_caption_button.h" 7 #include "ash/frame/caption_buttons/frame_caption_button.h"
8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
11 #include "ash/test/test_session_state_delegate.h" 11 #include "ash/test/test_session_state_delegate.h"
12 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 12 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "grit/ash_resources.h" 14 #include "grit/ash_resources.h"
15 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/gfx/image/image_skia.h" 16 #include "ui/gfx/image/image_skia.h"
17 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
18 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
19 #include "ui/views/widget/widget_delegate.h" 19 #include "ui/views/widget/widget_delegate.h"
20 20
21 namespace ash { 21 namespace ash {
22 22
23 // A views::WidgetDelegate which uses a CustomFrameViewAsh. 23 // A views::WidgetDelegate which uses a CustomFrameViewAsh.
24 class TestWidgetDelegate : public views::WidgetDelegateView { 24 class TestWidgetDelegate : public views::WidgetDelegateView {
25 public: 25 public:
26 TestWidgetDelegate() {} 26 TestWidgetDelegate() {}
27 virtual ~TestWidgetDelegate() {} 27 ~TestWidgetDelegate() override {}
28 28
29 virtual views::NonClientFrameView* CreateNonClientFrameView( 29 views::NonClientFrameView* CreateNonClientFrameView(
30 views::Widget* widget) override { 30 views::Widget* widget) override {
31 custom_frame_view_ = new CustomFrameViewAsh(widget); 31 custom_frame_view_ = new CustomFrameViewAsh(widget);
32 return custom_frame_view_; 32 return custom_frame_view_;
33 } 33 }
34 34
35 CustomFrameViewAsh* custom_frame_view() const { 35 CustomFrameViewAsh* custom_frame_view() const {
36 return custom_frame_view_; 36 return custom_frame_view_;
37 } 37 }
38 38
39 private: 39 private:
40 // Not owned. 40 // Not owned.
41 CustomFrameViewAsh* custom_frame_view_; 41 CustomFrameViewAsh* custom_frame_view_;
42 42
43 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); 43 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate);
44 }; 44 };
45 45
46 class TestWidgetConstraintsDelegate : public TestWidgetDelegate { 46 class TestWidgetConstraintsDelegate : public TestWidgetDelegate {
47 public: 47 public:
48 TestWidgetConstraintsDelegate() {} 48 TestWidgetConstraintsDelegate() {}
49 virtual ~TestWidgetConstraintsDelegate() {} 49 ~TestWidgetConstraintsDelegate() override {}
50 50
51 // views::View: 51 // views::View:
52 virtual gfx::Size GetMinimumSize() const override { 52 gfx::Size GetMinimumSize() const override { return minimum_size_; }
53 return minimum_size_;
54 }
55 53
56 virtual gfx::Size GetMaximumSize() const override { 54 gfx::Size GetMaximumSize() const override { return maximum_size_; }
57 return maximum_size_;
58 }
59 55
60 virtual views::View* GetContentsView() override { 56 views::View* GetContentsView() override {
61 // Set this instance as the contents view so that the maximum and minimum 57 // Set this instance as the contents view so that the maximum and minimum
62 // size constraints will be used. 58 // size constraints will be used.
63 return this; 59 return this;
64 } 60 }
65 61
66 // views::WidgetDelegate: 62 // views::WidgetDelegate:
67 virtual bool CanMaximize() const override { 63 bool CanMaximize() const override { return true; }
68 return true;
69 }
70 64
71 virtual bool CanMinimize() const override { 65 bool CanMinimize() const override { return true; }
72 return true;
73 }
74 66
75 void set_minimum_size(const gfx::Size& min_size) { 67 void set_minimum_size(const gfx::Size& min_size) {
76 minimum_size_ = min_size; 68 minimum_size_ = min_size;
77 } 69 }
78 70
79 void set_maximum_size(const gfx::Size& max_size) { 71 void set_maximum_size(const gfx::Size& max_size) {
80 maximum_size_ = max_size; 72 maximum_size_ = max_size;
81 } 73 }
82 74
83 const gfx::Rect& GetFrameCaptionButtonContainerViewBounds() { 75 const gfx::Rect& GetFrameCaptionButtonContainerViewBounds() {
(...skipping 14 matching lines...) Expand all
98 private: 90 private:
99 gfx::Size minimum_size_; 91 gfx::Size minimum_size_;
100 gfx::Size maximum_size_; 92 gfx::Size maximum_size_;
101 93
102 DISALLOW_COPY_AND_ASSIGN(TestWidgetConstraintsDelegate); 94 DISALLOW_COPY_AND_ASSIGN(TestWidgetConstraintsDelegate);
103 }; 95 };
104 96
105 class CustomFrameViewAshTest : public test::AshTestBase { 97 class CustomFrameViewAshTest : public test::AshTestBase {
106 public: 98 public:
107 CustomFrameViewAshTest() {} 99 CustomFrameViewAshTest() {}
108 virtual ~CustomFrameViewAshTest() {} 100 ~CustomFrameViewAshTest() override {}
109 101
110 protected: 102 protected:
111 scoped_ptr<views::Widget> CreateWidget(TestWidgetDelegate* delegate) { 103 scoped_ptr<views::Widget> CreateWidget(TestWidgetDelegate* delegate) {
112 scoped_ptr<views::Widget> widget(new views::Widget); 104 scoped_ptr<views::Widget> widget(new views::Widget);
113 views::Widget::InitParams params; 105 views::Widget::InitParams params;
114 params.delegate = delegate; 106 params.delegate = delegate;
115 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 107 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
116 params.bounds = gfx::Rect(0, 0, 100, 100); 108 params.bounds = gfx::Rect(0, 0, 100, 100);
117 params.context = CurrentContext(); 109 params.context = CurrentContext();
118 widget->Init(params); 110 widget->Init(params);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); 220 EXPECT_GT(initial.width(), maximize_mode_bounds.width());
229 Shell::GetInstance()->maximize_mode_controller()-> 221 Shell::GetInstance()->maximize_mode_controller()->
230 EnableMaximizeModeWindowManager(false); 222 EnableMaximizeModeWindowManager(false);
231 delegate->EndFrameCaptionButtonContainerViewAnimations(); 223 delegate->EndFrameCaptionButtonContainerViewAnimations();
232 const gfx::Rect after_restore = delegate-> 224 const gfx::Rect after_restore = delegate->
233 GetFrameCaptionButtonContainerViewBounds(); 225 GetFrameCaptionButtonContainerViewBounds();
234 EXPECT_EQ(initial, after_restore); 226 EXPECT_EQ(initial, after_restore);
235 } 227 }
236 228
237 } // namespace ash 229 } // namespace ash
OLDNEW
« no previous file with comments | « ash/frame/custom_frame_view_ash.cc ('k') | ash/frame/default_header_painter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698