| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_helper_aura.h" | 5 #include "ui/views/test/views_test_helper_aura.h" |
| 6 | 6 |
| 7 #include "ui/aura/test/aura_test_helper.h" | 7 #include "ui/aura/test/aura_test_helper.h" |
| 8 #include "ui/wm/core/capture_controller.h" | 8 #include "ui/wm/core/capture_controller.h" |
| 9 #include "ui/wm/core/default_activation_client.h" | 9 #include "ui/wm/core/default_activation_client.h" |
| 10 #include "ui/wm/core/wm_state.h" | 10 #include "ui/wm/core/wm_state.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 ViewsTestHelper* ViewsTestHelper::Create(base::MessageLoopForUI* message_loop) { | 15 ViewsTestHelper* ViewsTestHelper::Create(base::MessageLoopForUI* message_loop, |
| 16 return new ViewsTestHelperAura(message_loop); | 16 ui::ContextFactory* context_factory) { |
| 17 return new ViewsTestHelperAura(message_loop, context_factory); |
| 17 } | 18 } |
| 18 | 19 |
| 19 ViewsTestHelperAura::ViewsTestHelperAura(base::MessageLoopForUI* message_loop) { | 20 ViewsTestHelperAura::ViewsTestHelperAura(base::MessageLoopForUI* message_loop, |
| 21 ui::ContextFactory* context_factory) |
| 22 : context_factory_(context_factory) { |
| 20 aura_test_helper_.reset(new aura::test::AuraTestHelper(message_loop)); | 23 aura_test_helper_.reset(new aura::test::AuraTestHelper(message_loop)); |
| 21 } | 24 } |
| 22 | 25 |
| 23 ViewsTestHelperAura::~ViewsTestHelperAura() { | 26 ViewsTestHelperAura::~ViewsTestHelperAura() { |
| 24 } | 27 } |
| 25 | 28 |
| 26 void ViewsTestHelperAura::SetUp() { | 29 void ViewsTestHelperAura::SetUp() { |
| 27 aura_test_helper_->SetUp(); | 30 aura_test_helper_->SetUp(context_factory_); |
| 28 new wm::DefaultActivationClient(aura_test_helper_->root_window()); | 31 new wm::DefaultActivationClient(aura_test_helper_->root_window()); |
| 29 wm_state_.reset(new wm::WMState); | 32 wm_state_.reset(new wm::WMState); |
| 30 } | 33 } |
| 31 | 34 |
| 32 void ViewsTestHelperAura::TearDown() { | 35 void ViewsTestHelperAura::TearDown() { |
| 33 aura_test_helper_->TearDown(); | 36 aura_test_helper_->TearDown(); |
| 34 wm_state_.reset(); | 37 wm_state_.reset(); |
| 35 CHECK(!wm::ScopedCaptureClient::IsActive()); | 38 CHECK(!wm::ScopedCaptureClient::IsActive()); |
| 36 } | 39 } |
| 37 | 40 |
| 38 gfx::NativeView ViewsTestHelperAura::GetContext() { | 41 gfx::NativeView ViewsTestHelperAura::GetContext() { |
| 39 return aura_test_helper_->root_window(); | 42 return aura_test_helper_->root_window(); |
| 40 } | 43 } |
| 41 | 44 |
| 42 } // namespace views | 45 } // namespace views |
| OLD | NEW |