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