| OLD | NEW |
| 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" | 11 #include "ui/base/material_design/material_design_controller.h" |
| 12 #include "ui/base/test/material_design_controller_test_api.h" | 12 #include "ui/base/test/material_design_controller_test_api.h" |
| 13 #include "ui/views/test/platform_test_helper.h" | |
| 14 | 13 |
| 15 namespace views { | 14 namespace views { |
| 16 | 15 |
| 17 ViewsTestBase::ViewsTestBase() | 16 ViewsTestBase::ViewsTestBase() |
| 18 : setup_called_(false), | 17 : setup_called_(false), |
| 19 teardown_called_(false) { | 18 teardown_called_(false) { |
| 20 } | 19 } |
| 21 | 20 |
| 22 ViewsTestBase::~ViewsTestBase() { | 21 ViewsTestBase::~ViewsTestBase() { |
| 23 CHECK(setup_called_) | 22 CHECK(setup_called_) |
| 24 << "You have overridden SetUp but never called super class's SetUp"; | 23 << "You have overridden SetUp but never called super class's SetUp"; |
| 25 CHECK(teardown_called_) | 24 CHECK(teardown_called_) |
| 26 << "You have overridden TearDown but never called super class's TearDown"; | 25 << "You have overridden TearDown but never called super class's TearDown"; |
| 27 } | 26 } |
| 28 | 27 |
| 29 // static | |
| 30 bool ViewsTestBase::IsMus() { | |
| 31 return PlatformTestHelper::IsMus(); | |
| 32 } | |
| 33 | |
| 34 void ViewsTestBase::SetUp() { | 28 void ViewsTestBase::SetUp() { |
| 35 testing::Test::SetUp(); | 29 testing::Test::SetUp(); |
| 36 // ContentTestSuiteBase might have already initialized | 30 // ContentTestSuiteBase might have already initialized |
| 37 // MaterialDesignController in unit_tests suite. | 31 // MaterialDesignController in unit_tests suite. |
| 38 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); | 32 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); |
| 39 ui::MaterialDesignController::Initialize(); | 33 ui::MaterialDesignController::Initialize(); |
| 40 setup_called_ = true; | 34 setup_called_ = true; |
| 41 if (!views_delegate_for_setup_) | 35 if (!views_delegate_for_setup_) |
| 42 views_delegate_for_setup_.reset(new TestViewsDelegate()); | 36 views_delegate_for_setup_.reset(new TestViewsDelegate()); |
| 43 | 37 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 70 | 64 |
| 71 void ViewsTestBase::DisableNativeWidgetMus() { | 65 void ViewsTestBase::DisableNativeWidgetMus() { |
| 72 ViewsDelegate::GetInstance()->set_native_widget_factory( | 66 ViewsDelegate::GetInstance()->set_native_widget_factory( |
| 73 ViewsDelegate::NativeWidgetFactory()); | 67 ViewsDelegate::NativeWidgetFactory()); |
| 74 } | 68 } |
| 75 | 69 |
| 76 gfx::NativeWindow ViewsTestBase::GetContext() { | 70 gfx::NativeWindow ViewsTestBase::GetContext() { |
| 77 return test_helper_->GetContext(); | 71 return test_helper_->GetContext(); |
| 78 } | 72 } |
| 79 | 73 |
| 74 bool ViewsTestBase::IsMus() const { |
| 75 return test_helper_->IsMus(); |
| 76 } |
| 77 |
| 80 } // namespace views | 78 } // namespace views |
| OLD | NEW |