| 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/views/test/platform_test_helper.h" | 9 #include "ui/views/test/platform_test_helper.h" |
| 10 #include "ui/wm/core/capture_controller.h" | 10 #include "ui/wm/core/capture_controller.h" |
| 11 #include "ui/wm/core/default_activation_client.h" | 11 #include "ui/wm/core/default_activation_client.h" |
| 12 #include "ui/wm/core/default_screen_position_client.h" | 12 #include "ui/wm/core/default_screen_position_client.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 ViewsTestHelper* ViewsTestHelper::Create(base::MessageLoopForUI* message_loop, | 17 ViewsTestHelper* ViewsTestHelper::Create( |
| 18 ui::ContextFactory* context_factory) { | 18 base::MessageLoopForUI* message_loop, |
| 19 return new ViewsTestHelperAura(message_loop, context_factory); | 19 ui::ContextFactory* context_factory, |
| 20 ui::ContextFactoryPrivate* context_factory_private) { |
| 21 return new ViewsTestHelperAura(message_loop, context_factory, |
| 22 context_factory_private); |
| 20 } | 23 } |
| 21 | 24 |
| 22 ViewsTestHelperAura::ViewsTestHelperAura(base::MessageLoopForUI* message_loop, | 25 ViewsTestHelperAura::ViewsTestHelperAura( |
| 23 ui::ContextFactory* context_factory) | 26 base::MessageLoopForUI* message_loop, |
| 24 : context_factory_(context_factory) { | 27 ui::ContextFactory* context_factory, |
| 28 ui::ContextFactoryPrivate* context_factory_private) |
| 29 : context_factory_(context_factory), |
| 30 context_factory_private_(context_factory_private) { |
| 25 aura_test_helper_.reset(new aura::test::AuraTestHelper(message_loop)); | 31 aura_test_helper_.reset(new aura::test::AuraTestHelper(message_loop)); |
| 26 } | 32 } |
| 27 | 33 |
| 28 ViewsTestHelperAura::~ViewsTestHelperAura() { | 34 ViewsTestHelperAura::~ViewsTestHelperAura() { |
| 29 } | 35 } |
| 30 | 36 |
| 31 void ViewsTestHelperAura::EnableMusWithWindowTreeClient( | 37 void ViewsTestHelperAura::EnableMusWithWindowTreeClient( |
| 32 aura::WindowTreeClient* window_tree_client) { | 38 aura::WindowTreeClient* window_tree_client) { |
| 33 aura_test_helper_->EnableMusWithWindowTreeClient(window_tree_client); | 39 aura_test_helper_->EnableMusWithWindowTreeClient(window_tree_client); |
| 34 } | 40 } |
| 35 | 41 |
| 36 void ViewsTestHelperAura::SetUp() { | 42 void ViewsTestHelperAura::SetUp() { |
| 37 aura_test_helper_->SetUp(context_factory_); | 43 aura_test_helper_->SetUp(context_factory_, context_factory_private_); |
| 38 | 44 |
| 39 // GetContext() may return null. See comment in GetContext(). | 45 // GetContext() may return null. See comment in GetContext(). |
| 40 gfx::NativeWindow root_window = GetContext(); | 46 gfx::NativeWindow root_window = GetContext(); |
| 41 if (!root_window) | 47 if (!root_window) |
| 42 return; | 48 return; |
| 43 | 49 |
| 44 new wm::DefaultActivationClient(root_window); | 50 new wm::DefaultActivationClient(root_window); |
| 45 | 51 |
| 46 if (!aura::client::GetScreenPositionClient(root_window)) { | 52 if (!aura::client::GetScreenPositionClient(root_window)) { |
| 47 screen_position_client_.reset(new wm::DefaultScreenPositionClient); | 53 screen_position_client_.reset(new wm::DefaultScreenPositionClient); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 78 // single display that is intended for an ash like environment. Such a | 84 // single display that is intended for an ash like environment. Such a |
| 79 // configuration doesn't make sense for aura-mus-client, where it's testing | 85 // configuration doesn't make sense for aura-mus-client, where it's testing |
| 80 // DesktopNativeWidgetAura. | 86 // DesktopNativeWidgetAura. |
| 81 return nullptr; | 87 return nullptr; |
| 82 } | 88 } |
| 83 | 89 |
| 84 return aura_test_helper_->root_window(); | 90 return aura_test_helper_->root_window(); |
| 85 } | 91 } |
| 86 | 92 |
| 87 } // namespace views | 93 } // namespace views |
| OLD | NEW |