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

Side by Side Diff: ui/views/widget/root_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 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 "ui/views/widget/root_view.h" 5 #include "ui/views/widget/root_view.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/views/context_menu_controller.h" 10 #include "ui/views/context_menu_controller.h"
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 } 542 }
543 543
544 namespace { 544 namespace {
545 class RootViewTestDialogDelegate : public DialogDelegateView { 545 class RootViewTestDialogDelegate : public DialogDelegateView {
546 public: 546 public:
547 RootViewTestDialogDelegate() {} 547 RootViewTestDialogDelegate() {}
548 548
549 int layout_count() const { return layout_count_; } 549 int layout_count() const { return layout_count_; }
550 550
551 // DialogDelegateView: 551 // DialogDelegateView:
552 gfx::Size GetPreferredSize() const override { return preferred_size_; } 552 gfx::Size GetUnsnappedPreferredSize() const override {
553 return preferred_size_;
554 }
553 void Layout() override { 555 void Layout() override {
554 EXPECT_EQ(size(), preferred_size_); 556 EXPECT_EQ(size(), preferred_size_);
555 ++layout_count_; 557 ++layout_count_;
556 } 558 }
557 int GetDialogButtons() const override { 559 int GetDialogButtons() const override {
558 return ui::DIALOG_BUTTON_NONE; // Ensure buttons do not influence size. 560 return ui::DIALOG_BUTTON_NONE; // Ensure buttons do not influence size.
559 } 561 }
560 562
561 private: 563 private:
562 const gfx::Size preferred_size_ = gfx::Size(111, 111); 564 const gfx::Size preferred_size_ = gfx::Size(111, 111);
(...skipping 16 matching lines...) Expand all
579 // Also test Aura desktop Widget codepaths. 581 // Also test Aura desktop Widget codepaths.
580 views_delegate()->set_use_desktop_native_widgets(true); 582 views_delegate()->set_use_desktop_native_widgets(true);
581 delegate = new RootViewTestDialogDelegate(); 583 delegate = new RootViewTestDialogDelegate();
582 widget = DialogDelegate::CreateDialogWidget(delegate, GetContext(), nullptr); 584 widget = DialogDelegate::CreateDialogWidget(delegate, GetContext(), nullptr);
583 EXPECT_EQ(1, delegate->layout_count()); 585 EXPECT_EQ(1, delegate->layout_count());
584 widget->CloseNow(); 586 widget->CloseNow();
585 } 587 }
586 588
587 } // namespace test 589 } // namespace test
588 } // namespace views 590 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698