OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/i18n/icu_util.h" | 8 #include "base/i18n/icu_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "ui/aura/env.h" | |
13 #include "ui/base/ime/input_method_initializer.h" | 12 #include "ui/base/ime/input_method_initializer.h" |
14 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/base/ui_base_paths.h" | 14 #include "ui/base/ui_base_paths.h" |
16 #include "ui/compositor/test/in_process_context_factory.h" | 15 #include "ui/compositor/test/in_process_context_factory.h" |
17 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
18 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
19 #include "ui/views/examples/example_base.h" | 18 #include "ui/views/examples/example_base.h" |
20 #include "ui/views/examples/examples_window.h" | 19 #include "ui/views/examples/examples_window.h" |
21 #include "ui/views/test/desktop_test_views_delegate.h" | 20 #include "ui/views/test/desktop_test_views_delegate.h" |
| 21 |
| 22 #if defined(USE_AURA) |
| 23 #include "ui/aura/env.h" |
22 #include "ui/wm/core/wm_state.h" | 24 #include "ui/wm/core/wm_state.h" |
| 25 #endif |
23 | 26 |
24 #if !defined(OS_CHROMEOS) | 27 #if !defined(OS_CHROMEOS) && defined(USE_AURA) |
25 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 28 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
26 #endif | 29 #endif |
27 | 30 |
28 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
29 #include "ui/base/win/scoped_ole_initializer.h" | 32 #include "ui/base/win/scoped_ole_initializer.h" |
30 #endif | 33 #endif |
31 | 34 |
32 #if defined(USE_X11) | 35 #if defined(USE_X11) |
33 #include "ui/gfx/x/x11_connection.h" | 36 #include "ui/gfx/x/x11_connection.h" |
34 #endif | 37 #endif |
(...skipping 22 matching lines...) Expand all Loading... |
57 base::MessageLoopForUI message_loop; | 60 base::MessageLoopForUI message_loop; |
58 | 61 |
59 base::i18n::InitializeICU(); | 62 base::i18n::InitializeICU(); |
60 | 63 |
61 ui::RegisterPathProvider(); | 64 ui::RegisterPathProvider(); |
62 | 65 |
63 base::FilePath ui_test_pak_path; | 66 base::FilePath ui_test_pak_path; |
64 DCHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); | 67 DCHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
65 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); | 68 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
66 | 69 |
| 70 #if defined(USE_AURA) |
67 aura::Env::CreateInstance(true); | 71 aura::Env::CreateInstance(true); |
68 aura::Env::GetInstance()->set_context_factory(context_factory.get()); | 72 aura::Env::GetInstance()->set_context_factory(context_factory.get()); |
69 | 73 #endif |
70 ui::InitializeInputMethodForTesting(); | 74 ui::InitializeInputMethodForTesting(); |
71 | 75 |
72 { | 76 { |
73 views::DesktopTestViewsDelegate views_delegate; | 77 views::DesktopTestViewsDelegate views_delegate; |
| 78 #if defined(USE_AURA) |
74 wm::WMState wm_state; | 79 wm::WMState wm_state; |
75 | 80 #endif |
76 #if !defined(OS_CHROMEOS) | 81 #if !defined(OS_CHROMEOS) && defined(USE_AURA) |
77 scoped_ptr<gfx::Screen> desktop_screen(views::CreateDesktopScreen()); | 82 scoped_ptr<gfx::Screen> desktop_screen(views::CreateDesktopScreen()); |
78 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, | 83 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, |
79 desktop_screen.get()); | 84 desktop_screen.get()); |
80 #endif | 85 #endif |
81 | 86 |
82 views::examples::ShowExamplesWindow( | 87 views::examples::ShowExamplesWindow( |
83 views::examples::QUIT_ON_CLOSE, | 88 views::examples::QUIT_ON_CLOSE, |
84 NULL, | 89 NULL, |
85 scoped_ptr<ScopedVector<views::examples::ExampleBase> >()); | 90 scoped_ptr<ScopedVector<views::examples::ExampleBase> >()); |
86 | 91 |
87 base::RunLoop().Run(); | 92 base::RunLoop().Run(); |
88 | 93 |
89 ui::ResourceBundle::CleanupSharedInstance(); | 94 ui::ResourceBundle::CleanupSharedInstance(); |
90 } | 95 } |
91 | 96 |
92 ui::ShutdownInputMethod(); | 97 ui::ShutdownInputMethod(); |
93 | 98 |
| 99 #if defined(USE_AURA) |
94 aura::Env::DeleteInstance(); | 100 aura::Env::DeleteInstance(); |
| 101 #endif |
95 | 102 |
96 return 0; | 103 return 0; |
97 } | 104 } |
OLD | NEW |