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

Side by Side Diff: chrome/browser/ui/views/constrained_window_views_unittest.cc

Issue 628773002: replace OVERRIDE and FINAL with override and final in chrome/browser/ui/[t-v]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/views/constrained_window_views.h" 5 #include "chrome/browser/ui/views/constrained_window_views.h"
6 6
7 #include "components/web_modal/test_web_contents_modal_dialog_host.h" 7 #include "components/web_modal/test_web_contents_modal_dialog_host.h"
8 #include "ui/gfx/native_widget_types.h" 8 #include "ui/gfx/native_widget_types.h"
9 #include "ui/gfx/point.h" 9 #include "ui/gfx/point.h"
10 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
11 #include "ui/gfx/size.h" 11 #include "ui/gfx/size.h"
12 #include "ui/views/border.h" 12 #include "ui/views/border.h"
13 #include "ui/views/test/views_test_base.h" 13 #include "ui/views/test/views_test_base.h"
14 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
15 #include "ui/views/window/dialog_delegate.h" 15 #include "ui/views/window/dialog_delegate.h"
16 16
17 namespace views { 17 namespace views {
18 18
19 class DialogContents : public DialogDelegateView { 19 class DialogContents : public DialogDelegateView {
20 public: 20 public:
21 DialogContents() {} 21 DialogContents() {}
22 virtual ~DialogContents() {} 22 virtual ~DialogContents() {}
23 23
24 void set_preferred_size(const gfx::Size& preferred_size) { 24 void set_preferred_size(const gfx::Size& preferred_size) {
25 preferred_size_ = preferred_size; 25 preferred_size_ = preferred_size;
26 } 26 }
27 27
28 // Overriden from DialogDelegateView: 28 // Overriden from DialogDelegateView:
29 virtual View* GetContentsView() OVERRIDE { return this; } 29 virtual View* GetContentsView() override { return this; }
30 virtual gfx::Size GetPreferredSize() const OVERRIDE { 30 virtual gfx::Size GetPreferredSize() const override {
31 return preferred_size_; 31 return preferred_size_;
32 } 32 }
33 virtual gfx::Size GetMinimumSize() const OVERRIDE { return gfx::Size(); } 33 virtual gfx::Size GetMinimumSize() const override { return gfx::Size(); }
34 34
35 private: 35 private:
36 gfx::Size preferred_size_; 36 gfx::Size preferred_size_;
37 37
38 DISALLOW_COPY_AND_ASSIGN(DialogContents); 38 DISALLOW_COPY_AND_ASSIGN(DialogContents);
39 }; 39 };
40 40
41 class ConstrainedWindowViewsTest : public ViewsTestBase { 41 class ConstrainedWindowViewsTest : public ViewsTestBase {
42 public: 42 public:
43 ConstrainedWindowViewsTest() : contents_(NULL) {} 43 ConstrainedWindowViewsTest() : contents_(NULL) {}
44 virtual ~ConstrainedWindowViewsTest() {} 44 virtual ~ConstrainedWindowViewsTest() {}
45 45
46 virtual void SetUp() OVERRIDE { 46 virtual void SetUp() override {
47 ViewsTestBase::SetUp(); 47 ViewsTestBase::SetUp();
48 contents_ = new DialogContents; 48 contents_ = new DialogContents;
49 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); 49 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
50 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 50 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
51 params.delegate = contents_; 51 params.delegate = contents_;
52 dialog_.reset(new Widget); 52 dialog_.reset(new Widget);
53 dialog_->Init(params); 53 dialog_->Init(params);
54 dialog_host_.reset(new web_modal::TestWebContentsModalDialogHost( 54 dialog_host_.reset(new web_modal::TestWebContentsModalDialogHost(
55 dialog_->GetNativeView())); 55 dialog_->GetNativeView()));
56 dialog_host_->set_max_dialog_size(gfx::Size(5000, 5000)); 56 dialog_host_->set_max_dialog_size(gfx::Size(5000, 5000));
57 57
58 // Make sure the dialog size is dominated by the preferred size of the 58 // Make sure the dialog size is dominated by the preferred size of the
59 // contents. 59 // contents.
60 gfx::Size preferred_size = dialog()->GetRootView()->GetPreferredSize(); 60 gfx::Size preferred_size = dialog()->GetRootView()->GetPreferredSize();
61 preferred_size.Enlarge(500, 500); 61 preferred_size.Enlarge(500, 500);
62 contents()->set_preferred_size(preferred_size); 62 contents()->set_preferred_size(preferred_size);
63 } 63 }
64 64
65 virtual void TearDown() OVERRIDE { 65 virtual void TearDown() override {
66 ViewsTestBase::TearDown(); 66 ViewsTestBase::TearDown();
67 contents_ = NULL; 67 contents_ = NULL;
68 dialog_host_.reset(); 68 dialog_host_.reset();
69 dialog_.reset(); 69 dialog_.reset();
70 } 70 }
71 71
72 gfx::Size GetDialogSize() { 72 gfx::Size GetDialogSize() {
73 return dialog()->GetRootView()->GetBoundsInScreen().size(); 73 return dialog()->GetRootView()->GetBoundsInScreen().size();
74 } 74 }
75 75
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 // Increasing the maximum dialog size should bring the dialog back to its 146 // Increasing the maximum dialog size should bring the dialog back to its
147 // original size. 147 // original size.
148 max_dialog_size.Enlarge(100, 100); 148 max_dialog_size.Enlarge(100, 100);
149 dialog_host()->set_max_dialog_size(max_dialog_size); 149 dialog_host()->set_max_dialog_size(max_dialog_size);
150 UpdateWebContentsModalDialogPosition(dialog(), dialog_host()); 150 UpdateWebContentsModalDialogPosition(dialog(), dialog_host());
151 EXPECT_EQ(full_dialog_size.ToString(), GetDialogSize().ToString()); 151 EXPECT_EQ(full_dialog_size.ToString(), GetDialogSize().ToString());
152 } 152 }
153 153
154 } // namespace views 154 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698