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

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

Issue 1845343005: Makes MaterialDesignController initialization explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed methods in Linux bits 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
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"
11 13
12 namespace views { 14 namespace views {
13 15
14 ViewsTestBase::ViewsTestBase() 16 ViewsTestBase::ViewsTestBase()
15 : setup_called_(false), 17 : setup_called_(false),
16 teardown_called_(false) { 18 teardown_called_(false) {
17 } 19 }
18 20
19 ViewsTestBase::~ViewsTestBase() { 21 ViewsTestBase::~ViewsTestBase() {
20 CHECK(setup_called_) 22 CHECK(setup_called_)
21 << "You have overridden SetUp but never called super class's SetUp"; 23 << "You have overridden SetUp but never called super class's SetUp";
22 CHECK(teardown_called_) 24 CHECK(teardown_called_)
23 << "You have overridden TearDown but never called super class's TearDown"; 25 << "You have overridden TearDown but never called super class's TearDown";
24 } 26 }
25 27
26 void ViewsTestBase::SetUp() { 28 void ViewsTestBase::SetUp() {
27 testing::Test::SetUp(); 29 testing::Test::SetUp();
30 // ContentTestSuiteBase might have already initialized
sky 2016/04/11 15:32:41 and here
31 // MaterialDesignController in unit_tests suite.
32 ui::test::MaterialDesignControllerTestAPI::UninitializeMode();
33 ui::MaterialDesignController::Initialize();
28 setup_called_ = true; 34 setup_called_ = true;
29 if (!views_delegate_for_setup_) 35 if (!views_delegate_for_setup_)
30 views_delegate_for_setup_.reset(new TestViewsDelegate()); 36 views_delegate_for_setup_.reset(new TestViewsDelegate());
31 37
32 test_helper_.reset( 38 test_helper_.reset(
33 new ScopedViewsTestHelper(std::move(views_delegate_for_setup_))); 39 new ScopedViewsTestHelper(std::move(views_delegate_for_setup_)));
34 } 40 }
35 41
36 void ViewsTestBase::TearDown() { 42 void ViewsTestBase::TearDown() {
37 ui::Clipboard::DestroyClipboardForCurrentThread(); 43 ui::Clipboard::DestroyClipboardForCurrentThread();
(...skipping 25 matching lines...) Expand all
63 69
64 gfx::NativeWindow ViewsTestBase::GetContext() { 70 gfx::NativeWindow ViewsTestBase::GetContext() {
65 return test_helper_->GetContext(); 71 return test_helper_->GetContext();
66 } 72 }
67 73
68 bool ViewsTestBase::IsMus() const { 74 bool ViewsTestBase::IsMus() const {
69 return test_helper_->IsMus(); 75 return test_helper_->IsMus();
70 } 76 }
71 77
72 } // namespace views 78 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698