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

Side by Side Diff: ui/views/window/dialog_client_view_unittest.cc

Issue 2785683003: views: implement width snapping for DialogDelegateViews (Closed)
Patch Set: Created 3 years, 8 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 (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/views/window/dialog_client_view.h" 5 #include "ui/views/window/dialog_client_view.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/base/test/material_design_controller_test_api.h" 10 #include "ui/base/test/material_design_controller_test_api.h"
(...skipping 26 matching lines...) Expand all
37 widget_->Init(params); 37 widget_->Init(params);
38 EXPECT_EQ(this, GetContentsView()); 38 EXPECT_EQ(this, GetContentsView());
39 } 39 }
40 40
41 void TearDown() override { 41 void TearDown() override {
42 widget_->CloseNow(); 42 widget_->CloseNow();
43 WidgetTest::TearDown(); 43 WidgetTest::TearDown();
44 } 44 }
45 45
46 // DialogDelegateView: 46 // DialogDelegateView:
47 gfx::Size GetPreferredSize() const override { return preferred_size_; } 47 gfx::Size GetUnsnappedPreferredSize() const override {
48 return preferred_size_;
49 }
48 gfx::Size GetMinimumSize() const override { return min_size_; } 50 gfx::Size GetMinimumSize() const override { return min_size_; }
49 gfx::Size GetMaximumSize() const override { return max_size_; } 51 gfx::Size GetMaximumSize() const override { return max_size_; }
50 ClientView* CreateClientView(Widget* widget) override { 52 ClientView* CreateClientView(Widget* widget) override {
51 client_view_ = new DialogClientView(widget, this); 53 client_view_ = new DialogClientView(widget, this);
52 return client_view_; 54 return client_view_;
53 } 55 }
54 56
55 bool ShouldUseCustomFrame() const override { return false; } 57 bool ShouldUseCustomFrame() const override { return false; }
56 58
57 void DeleteDelegate() override { 59 void DeleteDelegate() override {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 delete extra_button; 401 delete extra_button;
400 402
401 // Non-buttons should always be sized to their preferred size. 403 // Non-buttons should always be sized to their preferred size.
402 View* boring_view = new StaticSizedView(gfx::Size(20, 20)); 404 View* boring_view = new StaticSizedView(gfx::Size(20, 20));
403 SetExtraView(boring_view); 405 SetExtraView(boring_view);
404 CheckContentsIsSetToPreferredSize(); 406 CheckContentsIsSetToPreferredSize();
405 EXPECT_EQ(20, boring_view->width()); 407 EXPECT_EQ(20, boring_view->width());
406 } 408 }
407 409
408 } // namespace views 410 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698