| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/scoped_views_test_helper.h" | 5 #include "ui/views/test/scoped_views_test_helper.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 10 #include "ui/base/ime/input_method_initializer.h" | 11 #include "ui/base/ime/input_method_initializer.h" |
| 11 #include "ui/compositor/test/context_factories_for_test.h" | 12 #include "ui/compositor/test/context_factories_for_test.h" |
| 12 #include "ui/views/test/platform_test_helper.h" | 13 #include "ui/views/test/platform_test_helper.h" |
| 13 #include "ui/views/test/test_views_delegate.h" | 14 #include "ui/views/test/test_views_delegate.h" |
| 14 #include "ui/views/test/views_test_helper.h" | 15 #include "ui/views/test/views_test_helper.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 | 18 |
| 18 ScopedViewsTestHelper::ScopedViewsTestHelper() | 19 ScopedViewsTestHelper::ScopedViewsTestHelper() |
| 19 : ScopedViewsTestHelper(make_scoped_ptr(new TestViewsDelegate)) { | 20 : ScopedViewsTestHelper(base::WrapUnique(new TestViewsDelegate)) {} |
| 20 } | |
| 21 | 21 |
| 22 ScopedViewsTestHelper::ScopedViewsTestHelper( | 22 ScopedViewsTestHelper::ScopedViewsTestHelper( |
| 23 scoped_ptr<TestViewsDelegate> views_delegate) | 23 std::unique_ptr<TestViewsDelegate> views_delegate) |
| 24 : views_delegate_(std::move(views_delegate)), | 24 : views_delegate_(std::move(views_delegate)), |
| 25 platform_test_helper_(PlatformTestHelper::Create()) { | 25 platform_test_helper_(PlatformTestHelper::Create()) { |
| 26 // The ContextFactory must exist before any Compositors are created. | 26 // The ContextFactory must exist before any Compositors are created. |
| 27 bool enable_pixel_output = false; | 27 bool enable_pixel_output = false; |
| 28 ui::ContextFactory* context_factory = | 28 ui::ContextFactory* context_factory = |
| 29 ui::InitializeContextFactoryForTests(enable_pixel_output); | 29 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| 30 views_delegate_->set_context_factory(context_factory); | 30 views_delegate_->set_context_factory(context_factory); |
| 31 | 31 |
| 32 test_helper_.reset(ViewsTestHelper::Create(base::MessageLoopForUI::current(), | 32 test_helper_.reset(ViewsTestHelper::Create(base::MessageLoopForUI::current(), |
| 33 context_factory)); | 33 context_factory)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 52 | 52 |
| 53 gfx::NativeWindow ScopedViewsTestHelper::GetContext() { | 53 gfx::NativeWindow ScopedViewsTestHelper::GetContext() { |
| 54 return test_helper_->GetContext(); | 54 return test_helper_->GetContext(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool ScopedViewsTestHelper::IsMus() const { | 57 bool ScopedViewsTestHelper::IsMus() const { |
| 58 return platform_test_helper_->IsMus(); | 58 return platform_test_helper_->IsMus(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace views | 61 } // namespace views |
| OLD | NEW |