Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: athena/test/athena_test_helper.cc

Issue 480353006: Separate athena's startup process from AppShell's (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reformat Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: athena/test/athena_test_helper.cc
diff --git a/athena/test/athena_test_helper.cc b/athena/test/athena_test_helper.cc
index e99b002fc537f187b23a2143bb9ef9535cb822ee..b2353d566ec912400fbdd625f9f1a2e3684d078a 100644
--- a/athena/test/athena_test_helper.cc
+++ b/athena/test/athena_test_helper.cc
@@ -4,28 +4,20 @@
#include "athena/test/athena_test_helper.h"
+#include "athena/env/public/athena_env.h"
#include "athena/extensions/public/extensions_delegate.h"
#include "athena/main/athena_launcher.h"
-#include "athena/screen/public/screen_manager.h"
#include "athena/test/sample_activity_factory.h"
#include "athena/test/test_app_model_builder.h"
-#include "athena/test/test_screen_manager_delegate.h"
-#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/threading/thread.h"
#include "chromeos/dbus/dbus_thread_manager.h"
-#include "ui/app_list/app_list_switches.h"
-#include "ui/aura/client/aura_constants.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/window_event_dispatcher.h"
#include "ui/base/ime/input_method_initializer.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
-#include "ui/gfx/screen.h"
#include "ui/wm/core/focus_controller.h"
#include "ui/wm/core/input_method_event_filter.h"
@@ -56,12 +48,8 @@ void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) {
base::Thread::Options options(base::MessageLoop::TYPE_IO, 0);
file_thread_->StartWithOptions(options);
- // Force showing in the experimental app-list view.
- base::CommandLine::ForCurrentProcess()->AppendSwitch(
- app_list::switches::kEnableExperimentalAppList);
-
chromeos::DBusThreadManager::InitializeWithStub();
-
+ ui::InitializeInputMethodForTesting();
aura::Env::CreateInstance(true);
aura::Env::GetInstance()->set_context_factory(context_factory);
@@ -70,33 +58,7 @@ void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) {
aura::test::EnvTestHelper(aura::Env::GetInstance())
.SetInputStateLookup(scoped_ptr<aura::InputStateLookup>());
- ui::InitializeInputMethodForTesting();
-
- const gfx::Size host_size(800, 600);
- test_screen_.reset(aura::TestScreen::Create(host_size));
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
- host_.reset(test_screen_->CreateHostForPrimaryDisplay());
- screen_manager_delegate_.reset(
- new TestScreenManagerDelegate(test_screen_.get()));
-
- input_method_filter_.reset(new ::wm::InputMethodEventFilter(
- root_window()->GetHost()->GetAcceleratedWidget()));
- input_method_filter_->SetInputMethodPropertyInRootWindow(
- root_window());
-
- wm::FocusController* focus_controller =
- new wm::FocusController(ScreenManager::CreateFocusRules());
- aura::client::SetFocusClient(root_window(), focus_controller);
- root_window()->AddPreTargetHandler(focus_controller);
- aura::client::SetActivationClient(root_window(), focus_controller);
- focus_client_.reset(focus_controller);
-
- root_window()->Show();
- // Ensure width != height so tests won't confuse them.
- host()->SetBounds(gfx::Rect(host_size));
-
- athena::StartAthenaEnv(root_window(), screen_manager_delegate_.get(),
- file_thread_->message_loop_proxy());
+ athena::StartAthenaEnv(file_thread_->message_loop_proxy());
athena::ExtensionsDelegate::CreateExtensionsDelegateForTest();
athena::StartAthenaSession(new SampleActivityFactory(),
new TestAppModelBuilder());
@@ -106,25 +68,22 @@ void AthenaTestHelper::TearDown() {
teardown_called_ = true;
athena::ShutdownAthena();
-
- aura::client::SetFocusClient(root_window(), NULL);
- focus_client_.reset();
- input_method_filter_.reset();
-
- host_.reset();
- ui::GestureRecognizer::Reset();
- test_screen_.reset();
- gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL);
+ aura::Env::DeleteInstance();
#if defined(USE_X11)
ui::test::ResetXCursorCache();
#endif
ui::ShutdownInputMethodForTesting();
-
chromeos::DBusThreadManager::Shutdown();
+}
- aura::Env::DeleteInstance();
+aura::Window* AthenaTestHelper::GetRootWindow() {
+ return GetHost()->window();
+}
+
+aura::WindowTreeHost* AthenaTestHelper::GetHost() {
+ return AthenaEnv::Get()->GetHost();
}
void AthenaTestHelper::RunAllPendingInMessageLoop() {

Powered by Google App Engine
This is Rietveld 408576698