| 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/activity/public/activity_manager.h" |
| 6 #include "athena/main/sample_activity.h" |
| 5 #include "athena/test/athena_test_helper.h" | 7 #include "athena/test/athena_test_helper.h" |
| 6 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/path_service.h" |
| 10 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" |
| 11 #include "ui/aura/window_tree_host.h" | 15 #include "ui/aura/window_tree_host.h" |
| 16 #include "ui/base/resource/resource_bundle.h" |
| 17 #include "ui/base/ui_base_paths.h" |
| 12 #include "ui/compositor/test/context_factories_for_test.h" | 18 #include "ui/compositor/test/context_factories_for_test.h" |
| 13 #include "ui/gl/gl_surface.h" | 19 #include "ui/gl/gl_surface.h" |
| 14 | 20 |
| 15 class UIShell { | 21 class UIShell { |
| 16 public: | 22 public: |
| 17 explicit UIShell(base::MessageLoopForUI* message_loop) | 23 explicit UIShell(base::MessageLoopForUI* message_loop) |
| 18 : athena_helper_(message_loop) { | 24 : athena_helper_(message_loop) { |
| 19 const bool enable_pixel_output = true; | 25 const bool enable_pixel_output = true; |
| 20 ui::ContextFactory* factory = | 26 ui::ContextFactory* factory = |
| 21 ui::InitializeContextFactoryForTests(enable_pixel_output); | 27 ui::InitializeContextFactoryForTests(enable_pixel_output); |
| 22 athena_helper_.SetUp(factory); | 28 athena_helper_.SetUp(factory); |
| 23 athena_helper_.host()->Show(); | 29 athena_helper_.host()->Show(); |
| 30 |
| 31 InitSampleActivities(); |
| 32 } |
| 33 |
| 34 void InitSampleActivities() { |
| 35 athena::Activity* task = new SampleActivity( |
| 36 SK_ColorRED, SK_ColorGREEN, std::string("Activity 1")); |
| 37 athena::ActivityManager::Get()->AddActivity(task); |
| 24 } | 38 } |
| 25 | 39 |
| 26 private: | 40 private: |
| 27 athena::test::AthenaTestHelper athena_helper_; | 41 athena::test::AthenaTestHelper athena_helper_; |
| 28 | 42 |
| 29 DISALLOW_COPY_AND_ASSIGN(UIShell); | 43 DISALLOW_COPY_AND_ASSIGN(UIShell); |
| 30 }; | 44 }; |
| 31 | 45 |
| 32 int main(int argc, const char **argv) { | 46 int main(int argc, const char **argv) { |
| 33 setlocale(LC_ALL, ""); | 47 setlocale(LC_ALL, ""); |
| 34 | 48 |
| 35 base::AtExitManager exit_manager; | 49 base::AtExitManager exit_manager; |
| 50 ui::RegisterPathProvider(); |
| 36 base::CommandLine::Init(argc, argv); | 51 base::CommandLine::Init(argc, argv); |
| 37 base::i18n::InitializeICU(); | 52 base::i18n::InitializeICU(); |
| 38 gfx::GLSurface::InitializeOneOffForTests(); | 53 gfx::GLSurface::InitializeOneOffForTests(); |
| 39 | 54 |
| 55 base::FilePath ui_test_pak_path; |
| 56 DCHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); |
| 57 ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); |
| 58 |
| 40 base::MessageLoopForUI message_loop; | 59 base::MessageLoopForUI message_loop; |
| 41 UIShell shell(&message_loop); | 60 UIShell shell(&message_loop); |
| 42 base::RunLoop run_loop; | 61 base::RunLoop run_loop; |
| 43 run_loop.Run(); | 62 run_loop.Run(); |
| 44 } | 63 } |
| OLD | NEW |