OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "athena/home/public/home_card.h" | |
6 #include "athena/main/athena_launcher.h" | |
7 #include "athena/screen/public/screen_manager.h" | |
8 #include "athena/wm/public/window_manager.h" | |
oshima
2014/05/29 05:19:33
nit: I think you don't need home_card, screen_mana
sadrul
2014/05/30 02:29:48
Done.
| |
9 #include "base/at_exit.h" | |
10 #include "base/command_line.h" | |
11 #include "base/i18n/icu_util.h" | |
12 #include "base/message_loop/message_loop.h" | |
13 #include "base/run_loop.h" | |
14 #include "ui/aura/test/test_screen.h" | |
15 #include "ui/aura/window_tree_host.h" | |
16 #include "ui/base/ime/input_method_initializer.h" | |
17 #include "ui/compositor/compositor.h" | |
18 #include "ui/compositor/test/context_factories_for_test.h" | |
19 #include "ui/gl/gl_surface.h" | |
20 #include "ui/wm/core/visibility_controller.h" | |
21 #include "ui/wm/test/wm_test_helper.h" | |
oshima
2014/05/29 05:19:33
optional: does it make sense to use athena/test/at
sadrul
2014/05/30 02:29:48
Done.
| |
22 | |
23 class UIShell { | |
24 public: | |
25 UIShell() { | |
26 InitScreen(); | |
27 InitIME(); | |
28 InitWindow(); | |
29 athena::StartAthena(wm_helper_->host()->window()); | |
30 } | |
31 | |
32 void Show() { | |
33 wm_helper_->host()->Show(); | |
34 } | |
35 | |
36 private: | |
37 void InitScreen() { | |
38 test_screen_.reset(aura::TestScreen::Create()); | |
39 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | |
40 const bool enable_pixel_output = true; | |
41 ui::InitializeContextFactoryForTests(enable_pixel_output); | |
42 } | |
43 | |
44 void InitIME() { | |
45 ui::InitializeInputMethodForTesting(); | |
46 } | |
47 | |
48 void InitWindow() { | |
49 const gfx::Size window_size(800, 600); | |
50 wm_helper_.reset(new wm::WMTestHelper(window_size, | |
51 ui::ContextFactory::GetInstance())); | |
52 | |
53 visibility_controller_.reset(new wm::VisibilityController()); | |
54 aura::client::SetVisibilityClient(wm_helper_->host()->window(), | |
55 visibility_controller_.get()); | |
oshima
2014/05/29 14:54:23
one more nit. StartAthena does this, so you don't
sadrul
2014/05/30 02:29:48
Nice. Done.
| |
56 } | |
57 | |
58 scoped_ptr<aura::TestScreen> test_screen_; | |
59 scoped_ptr<wm::WMTestHelper> wm_helper_; | |
60 scoped_ptr<wm::VisibilityController> visibility_controller_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(UIShell); | |
63 }; | |
64 | |
65 int main(int argc, const char **argv) { | |
66 setlocale(LC_ALL, ""); | |
67 | |
68 base::AtExitManager exit_manager; | |
69 base::CommandLine::Init(argc, argv); | |
70 base::i18n::InitializeICU(); | |
71 gfx::GLSurface::InitializeOneOffForTests(); | |
72 | |
73 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); | |
74 (new UIShell())->Show(); | |
75 base::RunLoop run_loop; | |
76 run_loop.Run(); | |
77 } | |
OLD | NEW |