| Index: athena/test/athena_test_helper.cc
|
| diff --git a/ui/aura/test/aura_test_helper.cc b/athena/test/athena_test_helper.cc
|
| similarity index 52%
|
| copy from ui/aura/test/aura_test_helper.cc
|
| copy to athena/test/athena_test_helper.cc
|
| index 1b56512d376508eed8ae10942a520ebf3b37b455..701baaf4b16f1ee829e7b31c0e176940a328bac2 100644
|
| --- a/ui/aura/test/aura_test_helper.cc
|
| +++ b/athena/test/athena_test_helper.cc
|
| @@ -1,94 +1,93 @@
|
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ui/aura/test/aura_test_helper.h"
|
| +#include "athena/test/athena_test_helper.h"
|
|
|
| +#include "athena/main/athena_launcher.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/run_loop.h"
|
| #include "ui/aura/client/aura_constants.h"
|
| -#include "ui/aura/client/default_capture_client.h"
|
| -#include "ui/aura/client/focus_client.h"
|
| #include "ui/aura/env.h"
|
| #include "ui/aura/input_state_lookup.h"
|
| #include "ui/aura/test/env_test_helper.h"
|
| #include "ui/aura/test/test_focus_client.h"
|
| #include "ui/aura/test/test_screen.h"
|
| -#include "ui/aura/test/test_window_tree_client.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
| -#include "ui/base/ime/dummy_input_method.h"
|
| #include "ui/base/ime/input_method_initializer.h"
|
| -#include "ui/compositor/compositor.h"
|
| -#include "ui/compositor/layer_animator.h"
|
| #include "ui/compositor/scoped_animation_duration_scale_mode.h"
|
| #include "ui/gfx/screen.h"
|
| +#include "ui/wm/core/default_activation_client.h"
|
| +#include "ui/wm/core/input_method_event_filter.h"
|
|
|
| #if defined(USE_X11)
|
| #include "ui/aura/window_tree_host_x11.h"
|
| #include "ui/base/x/x11_util.h"
|
| #endif
|
|
|
| -namespace aura {
|
| +namespace athena {
|
| namespace test {
|
|
|
| -AuraTestHelper::AuraTestHelper(base::MessageLoopForUI* message_loop)
|
| - : setup_called_(false),
|
| - teardown_called_(false),
|
| - owns_host_(false) {
|
| +AthenaTestHelper::AthenaTestHelper(base::MessageLoopForUI* message_loop)
|
| + : setup_called_(false), teardown_called_(false) {
|
| DCHECK(message_loop);
|
| message_loop_ = message_loop;
|
| // Disable animations during tests.
|
| zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
|
| ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
|
| #if defined(USE_X11)
|
| - test::SetUseOverrideRedirectWindowByDefault(true);
|
| + aura::test::SetUseOverrideRedirectWindowByDefault(true);
|
| #endif
|
| }
|
|
|
| -AuraTestHelper::~AuraTestHelper() {
|
| - CHECK(setup_called_)
|
| - << "AuraTestHelper::SetUp() never called.";
|
| - CHECK(teardown_called_)
|
| - << "AuraTestHelper::TearDown() never called.";
|
| +AthenaTestHelper::~AthenaTestHelper() {
|
| + CHECK(setup_called_) << "AthenaTestHelper::SetUp() never called.";
|
| + CHECK(teardown_called_) << "AthenaTestHelper::TearDown() never called.";
|
| }
|
|
|
| -void AuraTestHelper::SetUp(ui::ContextFactory* context_factory) {
|
| +void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) {
|
| setup_called_ = true;
|
|
|
| - Env::CreateInstance(true);
|
| - Env::GetInstance()->set_context_factory(context_factory);
|
| + aura::Env::CreateInstance(true);
|
| + aura::Env::GetInstance()->set_context_factory(context_factory);
|
| +
|
| // Unit tests generally don't want to query the system, rather use the state
|
| // from RootWindow.
|
| - EnvTestHelper(Env::GetInstance()).SetInputStateLookup(
|
| - scoped_ptr<InputStateLookup>());
|
| + aura::test::EnvTestHelper(aura::Env::GetInstance())
|
| + .SetInputStateLookup(scoped_ptr<aura::InputStateLookup>());
|
|
|
| ui::InitializeInputMethodForTesting();
|
|
|
| - test_screen_.reset(TestScreen::Create());
|
| + test_screen_.reset(aura::TestScreen::Create());
|
| gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
|
| host_.reset(test_screen_->CreateHostForPrimaryDisplay());
|
|
|
| - focus_client_.reset(new TestFocusClient);
|
| - client::SetFocusClient(root_window(), focus_client_.get());
|
| - stacking_client_.reset(new TestWindowTreeClient(root_window()));
|
| - capture_client_.reset(new client::DefaultCaptureClient(root_window()));
|
| - test_input_method_.reset(new ui::DummyInputMethod);
|
| - root_window()->SetProperty(
|
| - client::kRootWindowInputMethodKey,
|
| - test_input_method_.get());
|
| + input_method_filter_.reset(new ::wm::InputMethodEventFilter(
|
| + root_window()->GetHost()->GetAcceleratedWidget()));
|
| + input_method_filter_->SetInputMethodPropertyInRootWindow(
|
| + root_window());
|
| +
|
| + // TODO(oshima): Switch to athena implementation.
|
| + focus_client_.reset(new aura::test::TestFocusClient);
|
| + aura::client::SetFocusClient(root_window(),
|
| + focus_client_.get());
|
| + new ::wm::DefaultActivationClient(root_window());
|
|
|
| root_window()->Show();
|
| // Ensure width != height so tests won't confuse them.
|
| host()->SetBounds(gfx::Rect(800, 600));
|
| +
|
| + athena::StartAthena(root_window());
|
| }
|
|
|
| -void AuraTestHelper::TearDown() {
|
| +void AthenaTestHelper::TearDown() {
|
| teardown_called_ = true;
|
| - test_input_method_.reset();
|
| - stacking_client_.reset();
|
| - capture_client_.reset();
|
| +
|
| + aura::client::SetFocusClient(root_window(), NULL);
|
| focus_client_.reset();
|
| - client::SetFocusClient(root_window(), NULL);
|
| + input_method_filter_.reset();
|
| +
|
| + athena::ShutdownAthena();
|
| host_.reset();
|
| ui::GestureRecognizer::Reset();
|
| test_screen_.reset();
|
| @@ -100,10 +99,10 @@ void AuraTestHelper::TearDown() {
|
|
|
| ui::ShutdownInputMethodForTesting();
|
|
|
| - Env::DeleteInstance();
|
| + aura::Env::DeleteInstance();
|
| }
|
|
|
| -void AuraTestHelper::RunAllPendingInMessageLoop() {
|
| +void AthenaTestHelper::RunAllPendingInMessageLoop() {
|
| // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
|
| // use run_loop.QuitClosure().
|
| base::RunLoop run_loop;
|
| @@ -111,4 +110,4 @@ void AuraTestHelper::RunAllPendingInMessageLoop() {
|
| }
|
|
|
| } // namespace test
|
| -} // namespace aura
|
| +} // namespace athena
|
|
|