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

Side by Side Diff: ui/views/test/views_test_base.cc

Issue 1878943002: Revert of Makes MaterialDesignController initialization explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « ui/views/linux_ui/linux_ui.h ('k') | no next file » | 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/views/test/views_test_base.h" 5 #include "ui/views/test/views_test_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "ui/base/clipboard/clipboard.h" 10 #include "ui/base/clipboard/clipboard.h"
11 #include "ui/base/material_design/material_design_controller.h"
12 #include "ui/base/test/material_design_controller_test_api.h"
13 11
14 namespace views { 12 namespace views {
15 13
16 ViewsTestBase::ViewsTestBase() 14 ViewsTestBase::ViewsTestBase()
17 : setup_called_(false), 15 : setup_called_(false),
18 teardown_called_(false) { 16 teardown_called_(false) {
19 } 17 }
20 18
21 ViewsTestBase::~ViewsTestBase() { 19 ViewsTestBase::~ViewsTestBase() {
22 CHECK(setup_called_) 20 CHECK(setup_called_)
23 << "You have overridden SetUp but never called super class's SetUp"; 21 << "You have overridden SetUp but never called super class's SetUp";
24 CHECK(teardown_called_) 22 CHECK(teardown_called_)
25 << "You have overridden TearDown but never called super class's TearDown"; 23 << "You have overridden TearDown but never called super class's TearDown";
26 } 24 }
27 25
28 void ViewsTestBase::SetUp() { 26 void ViewsTestBase::SetUp() {
29 testing::Test::SetUp(); 27 testing::Test::SetUp();
30 // ContentTestSuiteBase might have already initialized
31 // MaterialDesignController in unit_tests suite.
32 ui::test::MaterialDesignControllerTestAPI::UninitializeMode();
33 ui::MaterialDesignController::Initialize();
34 setup_called_ = true; 28 setup_called_ = true;
35 if (!views_delegate_for_setup_) 29 if (!views_delegate_for_setup_)
36 views_delegate_for_setup_.reset(new TestViewsDelegate()); 30 views_delegate_for_setup_.reset(new TestViewsDelegate());
37 31
38 test_helper_.reset( 32 test_helper_.reset(
39 new ScopedViewsTestHelper(std::move(views_delegate_for_setup_))); 33 new ScopedViewsTestHelper(std::move(views_delegate_for_setup_)));
40 } 34 }
41 35
42 void ViewsTestBase::TearDown() { 36 void ViewsTestBase::TearDown() {
43 ui::Clipboard::DestroyClipboardForCurrentThread(); 37 ui::Clipboard::DestroyClipboardForCurrentThread();
(...skipping 25 matching lines...) Expand all
69 63
70 gfx::NativeWindow ViewsTestBase::GetContext() { 64 gfx::NativeWindow ViewsTestBase::GetContext() {
71 return test_helper_->GetContext(); 65 return test_helper_->GetContext();
72 } 66 }
73 67
74 bool ViewsTestBase::IsMus() const { 68 bool ViewsTestBase::IsMus() const {
75 return test_helper_->IsMus(); 69 return test_helper_->IsMus();
76 } 70 }
77 71
78 } // namespace views 72 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/linux_ui/linux_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698