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