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 "athena/test/athena_test_helper.h" | 5 #include "athena/test/athena_test_helper.h" |
6 | 6 |
7 #include "athena/main/athena_launcher.h" | 7 #include "athena/main/athena_launcher.h" |
8 #include "athena/test/sample_activity_factory.h" | 8 #include "athena/test/sample_activity_factory.h" |
9 #include "athena/test/test_app_model_builder.h" | 9 #include "athena/test/test_app_model_builder.h" |
| 10 #include "base/command_line.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "ui/app_list/app_list_switches.h" |
12 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
13 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
14 #include "ui/aura/input_state_lookup.h" | 16 #include "ui/aura/input_state_lookup.h" |
15 #include "ui/aura/test/env_test_helper.h" | 17 #include "ui/aura/test/env_test_helper.h" |
16 #include "ui/aura/test/test_focus_client.h" | 18 #include "ui/aura/test/test_focus_client.h" |
17 #include "ui/aura/test/test_screen.h" | 19 #include "ui/aura/test/test_screen.h" |
18 #include "ui/aura/window_event_dispatcher.h" | 20 #include "ui/aura/window_event_dispatcher.h" |
19 #include "ui/base/ime/input_method_initializer.h" | 21 #include "ui/base/ime/input_method_initializer.h" |
20 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 22 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
21 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
(...skipping 17 matching lines...) Expand all Loading... |
39 } | 41 } |
40 | 42 |
41 AthenaTestHelper::~AthenaTestHelper() { | 43 AthenaTestHelper::~AthenaTestHelper() { |
42 CHECK(setup_called_) << "AthenaTestHelper::SetUp() never called."; | 44 CHECK(setup_called_) << "AthenaTestHelper::SetUp() never called."; |
43 CHECK(teardown_called_) << "AthenaTestHelper::TearDown() never called."; | 45 CHECK(teardown_called_) << "AthenaTestHelper::TearDown() never called."; |
44 } | 46 } |
45 | 47 |
46 void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) { | 48 void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) { |
47 setup_called_ = true; | 49 setup_called_ = true; |
48 | 50 |
| 51 // Force showing in the experimental app-list view. |
| 52 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 53 app_list::switches::kEnableExperimentalAppList); |
| 54 |
49 aura::Env::CreateInstance(true); | 55 aura::Env::CreateInstance(true); |
50 aura::Env::GetInstance()->set_context_factory(context_factory); | 56 aura::Env::GetInstance()->set_context_factory(context_factory); |
51 | 57 |
52 // 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 |
53 // from RootWindow. | 59 // from RootWindow. |
54 aura::test::EnvTestHelper(aura::Env::GetInstance()) | 60 aura::test::EnvTestHelper(aura::Env::GetInstance()) |
55 .SetInputStateLookup(scoped_ptr<aura::InputStateLookup>()); | 61 .SetInputStateLookup(scoped_ptr<aura::InputStateLookup>()); |
56 | 62 |
57 ui::InitializeInputMethodForTesting(); | 63 ui::InitializeInputMethodForTesting(); |
58 | 64 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 112 |
107 void AthenaTestHelper::RunAllPendingInMessageLoop() { | 113 void AthenaTestHelper::RunAllPendingInMessageLoop() { |
108 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 114 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them |
109 // use run_loop.QuitClosure(). | 115 // use run_loop.QuitClosure(). |
110 base::RunLoop run_loop; | 116 base::RunLoop run_loop; |
111 run_loop.RunUntilIdle(); | 117 run_loop.RunUntilIdle(); |
112 } | 118 } |
113 | 119 |
114 } // namespace test | 120 } // namespace test |
115 } // namespace athena | 121 } // namespace athena |
OLD | NEW |