| 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/client/screen_position_client.h" | 7 #include "ui/aura/client/screen_position_client.h" |
| 8 #include "ui/aura/test/aura_test_helper.h" | 8 #include "ui/aura/test/aura_test_helper.h" |
| 9 #include "ui/wm/core/capture_controller.h" | 9 #include "ui/wm/core/capture_controller.h" |
| 10 #include "ui/wm/core/default_activation_client.h" | 10 #include "ui/wm/core/default_activation_client.h" |
| 11 #include "ui/wm/core/default_screen_position_client.h" | 11 #include "ui/wm/core/default_screen_position_client.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 ViewsTestHelper* ViewsTestHelper::Create(base::MessageLoopForUI* message_loop, | 16 ViewsTestHelper* ViewsTestHelper::Create(base::MessageLoopForUI* message_loop, |
| 17 ui::ContextFactory* context_factory) { | 17 ui::ContextFactory* context_factory) { |
| 18 return new ViewsTestHelperAura(message_loop, context_factory); | 18 return new ViewsTestHelperAura(message_loop, context_factory); |
| 19 } | 19 } |
| 20 | 20 |
| 21 ViewsTestHelperAura::ViewsTestHelperAura(base::MessageLoopForUI* message_loop, | 21 ViewsTestHelperAura::ViewsTestHelperAura(base::MessageLoopForUI* message_loop, |
| 22 ui::ContextFactory* context_factory) | 22 ui::ContextFactory* context_factory) |
| 23 : context_factory_(context_factory) { | 23 : context_factory_(context_factory) { |
| 24 aura_test_helper_.reset(new aura::test::AuraTestHelper(message_loop)); | 24 aura_test_helper_.reset(new aura::test::AuraTestHelper(message_loop)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 ViewsTestHelperAura::~ViewsTestHelperAura() { | 27 ViewsTestHelperAura::~ViewsTestHelperAura() { |
| 28 } | 28 } |
| 29 | 29 |
| 30 void ViewsTestHelperAura::EnableMusWithWindowTreeClient( |
| 31 aura::WindowTreeClient* window_tree_client) { |
| 32 aura_test_helper_->EnableMusWithWindowTreeClient(window_tree_client); |
| 33 } |
| 34 |
| 30 void ViewsTestHelperAura::SetUp() { | 35 void ViewsTestHelperAura::SetUp() { |
| 31 aura_test_helper_->SetUp(context_factory_); | 36 aura_test_helper_->SetUp(context_factory_); |
| 32 gfx::NativeWindow root_window = GetContext(); | 37 gfx::NativeWindow root_window = GetContext(); |
| 33 new wm::DefaultActivationClient(root_window); | 38 new wm::DefaultActivationClient(root_window); |
| 34 | 39 |
| 35 if (!aura::client::GetScreenPositionClient(root_window)) { | 40 if (!aura::client::GetScreenPositionClient(root_window)) { |
| 36 screen_position_client_.reset(new wm::DefaultScreenPositionClient); | 41 screen_position_client_.reset(new wm::DefaultScreenPositionClient); |
| 37 aura::client::SetScreenPositionClient(root_window, | 42 aura::client::SetScreenPositionClient(root_window, |
| 38 screen_position_client_.get()); | 43 screen_position_client_.get()); |
| 39 } | 44 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 56 aura_test_helper_->TearDown(); | 61 aura_test_helper_->TearDown(); |
| 57 CHECK(!wm::CaptureController::Get() || | 62 CHECK(!wm::CaptureController::Get() || |
| 58 !wm::CaptureController::Get()->is_active()); | 63 !wm::CaptureController::Get()->is_active()); |
| 59 } | 64 } |
| 60 | 65 |
| 61 gfx::NativeWindow ViewsTestHelperAura::GetContext() { | 66 gfx::NativeWindow ViewsTestHelperAura::GetContext() { |
| 62 return aura_test_helper_->root_window(); | 67 return aura_test_helper_->root_window(); |
| 63 } | 68 } |
| 64 | 69 |
| 65 } // namespace views | 70 } // namespace views |
| OLD | NEW |