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

Side by Side Diff: athena/test/athena_test_helper.cc

Issue 483363003: [Athena] Add status icons and system time to the desktop background (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « athena/test/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "athena/test/athena_test_helper.h" 5 #include "athena/test/athena_test_helper.h"
6 6
7 #include "athena/env/public/athena_env.h" 7 #include "athena/env/public/athena_env.h"
8 #include "athena/extensions/public/extensions_delegate.h" 8 #include "athena/extensions/public/extensions_delegate.h"
9 #include "athena/main/athena_launcher.h" 9 #include "athena/main/athena_launcher.h"
10 #include "athena/test/sample_activity_factory.h" 10 #include "athena/test/sample_activity_factory.h"
11 #include "athena/test/test_app_model_builder.h" 11 #include "athena/test/test_app_model_builder.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "chromeos/dbus/dbus_thread_manager.h" 15 #include "chromeos/dbus/dbus_thread_manager.h"
16 #include "chromeos/network/network_handler.h"
16 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
17 #include "ui/aura/input_state_lookup.h" 18 #include "ui/aura/input_state_lookup.h"
18 #include "ui/aura/test/env_test_helper.h" 19 #include "ui/aura/test/env_test_helper.h"
19 #include "ui/base/ime/input_method_initializer.h" 20 #include "ui/base/ime/input_method_initializer.h"
20 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 21 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
21 #include "ui/wm/core/focus_controller.h" 22 #include "ui/wm/core/focus_controller.h"
22 #include "ui/wm/core/input_method_event_filter.h" 23 #include "ui/wm/core/input_method_event_filter.h"
23 24
24 #if defined(USE_X11) 25 #if defined(USE_X11)
25 #include "ui/base/x/x11_util.h" 26 #include "ui/base/x/x11_util.h"
(...skipping 16 matching lines...) Expand all
42 CHECK(teardown_called_) << "AthenaTestHelper::TearDown() never called."; 43 CHECK(teardown_called_) << "AthenaTestHelper::TearDown() never called.";
43 } 44 }
44 45
45 void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) { 46 void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) {
46 setup_called_ = true; 47 setup_called_ = true;
47 file_thread_.reset(new base::Thread("FileThread")); 48 file_thread_.reset(new base::Thread("FileThread"));
48 base::Thread::Options options(base::MessageLoop::TYPE_IO, 0); 49 base::Thread::Options options(base::MessageLoop::TYPE_IO, 0);
49 file_thread_->StartWithOptions(options); 50 file_thread_->StartWithOptions(options);
50 51
51 chromeos::DBusThreadManager::Initialize(); 52 chromeos::DBusThreadManager::Initialize();
53 chromeos::NetworkHandler::Initialize();
52 ui::InitializeInputMethodForTesting(); 54 ui::InitializeInputMethodForTesting();
53 aura::Env::CreateInstance(true); 55 aura::Env::CreateInstance(true);
54 aura::Env::GetInstance()->set_context_factory(context_factory); 56 aura::Env::GetInstance()->set_context_factory(context_factory);
55 57
56 // Unit tests generally don't want to query the system, rather use the state 58 // Unit tests generally don't want to query the system, rather use the state
57 // from RootWindow. 59 // from RootWindow.
58 aura::test::EnvTestHelper(aura::Env::GetInstance()) 60 aura::test::EnvTestHelper(aura::Env::GetInstance())
59 .SetInputStateLookup(scoped_ptr<aura::InputStateLookup>()); 61 .SetInputStateLookup(scoped_ptr<aura::InputStateLookup>());
60 62
61 athena::StartAthenaEnv(file_thread_->message_loop_proxy()); 63 athena::StartAthenaEnv(file_thread_->message_loop_proxy());
62 athena::ExtensionsDelegate::CreateExtensionsDelegateForTest(); 64 athena::ExtensionsDelegate::CreateExtensionsDelegateForTest();
63 athena::StartAthenaSession(new SampleActivityFactory(), 65 athena::StartAthenaSession(new SampleActivityFactory(),
64 new TestAppModelBuilder()); 66 new TestAppModelBuilder());
65 } 67 }
66 68
67 void AthenaTestHelper::TearDown() { 69 void AthenaTestHelper::TearDown() {
68 teardown_called_ = true; 70 teardown_called_ = true;
69 71
70 athena::ShutdownAthena(); 72 athena::ShutdownAthena();
71 aura::Env::DeleteInstance(); 73 aura::Env::DeleteInstance();
72 74
73 #if defined(USE_X11) 75 #if defined(USE_X11)
74 ui::test::ResetXCursorCache(); 76 ui::test::ResetXCursorCache();
75 #endif 77 #endif
76 78
77 ui::ShutdownInputMethodForTesting(); 79 ui::ShutdownInputMethodForTesting();
80 chromeos::NetworkHandler::Shutdown();
78 chromeos::DBusThreadManager::Shutdown(); 81 chromeos::DBusThreadManager::Shutdown();
79 } 82 }
80 83
81 aura::Window* AthenaTestHelper::GetRootWindow() { 84 aura::Window* AthenaTestHelper::GetRootWindow() {
82 return GetHost()->window(); 85 return GetHost()->window();
83 } 86 }
84 87
85 aura::WindowTreeHost* AthenaTestHelper::GetHost() { 88 aura::WindowTreeHost* AthenaTestHelper::GetHost() {
86 return AthenaEnv::Get()->GetHost(); 89 return AthenaEnv::Get()->GetHost();
87 } 90 }
88 91
89 void AthenaTestHelper::RunAllPendingInMessageLoop() { 92 void AthenaTestHelper::RunAllPendingInMessageLoop() {
90 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them 93 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
91 // use run_loop.QuitClosure(). 94 // use run_loop.QuitClosure().
92 base::RunLoop run_loop; 95 base::RunLoop run_loop;
93 run_loop.RunUntilIdle(); 96 run_loop.RunUntilIdle();
94 } 97 }
95 98
96 } // namespace test 99 } // namespace test
97 } // namespace athena 100 } // namespace athena
OLDNEW
« no previous file with comments | « athena/test/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698