Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: ui/aura/demo/demo_main.cc

Issue 45963003: Move test-only ContextFactory implementations out of production targets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix moar windows Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/i18n/icu_util.h" 7 #include "base/i18n/icu_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "third_party/skia/include/core/SkXfermode.h" 10 #include "third_party/skia/include/core/SkXfermode.h"
11 #include "ui/aura/client/default_capture_client.h" 11 #include "ui/aura/client/default_capture_client.h"
12 #include "ui/aura/client/window_tree_client.h" 12 #include "ui/aura/client/window_tree_client.h"
13 #include "ui/aura/env.h" 13 #include "ui/aura/env.h"
14 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
15 #include "ui/aura/test/test_focus_client.h" 15 #include "ui/aura/test/test_focus_client.h"
16 #include "ui/aura/test/test_screen.h" 16 #include "ui/aura/test/test_screen.h"
17 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
18 #include "ui/aura/window_delegate.h" 18 #include "ui/aura/window_delegate.h"
19 #include "ui/base/hit_test.h" 19 #include "ui/base/hit_test.h"
20 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/base/ui_base_paths.h" 21 #include "ui/base/ui_base_paths.h"
22 #include "ui/compositor/compositor.h" 22 #include "ui/compositor/test/context_factories_for_test.h"
23 #include "ui/events/event.h" 23 #include "ui/events/event.h"
24 #include "ui/gfx/canvas.h" 24 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/rect.h" 25 #include "ui/gfx/rect.h"
26 26
27 #if defined(USE_X11) 27 #if defined(USE_X11)
28 #include "base/message_loop/message_pump_x11.h" 28 #include "base/message_loop/message_pump_x11.h"
29 #endif 29 #endif
30 30
31 namespace { 31 namespace {
32 32
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); 106 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient);
107 }; 107 };
108 108
109 int DemoMain() { 109 int DemoMain() {
110 // Create the message-loop here before creating the root window. 110 // Create the message-loop here before creating the root window.
111 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); 111 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
112 112
113 // The ContextFactory must exist before any Compositors are created. 113 // The ContextFactory must exist before any Compositors are created.
114 bool allow_test_contexts = false; 114 bool allow_test_contexts = false;
115 ui::Compositor::InitializeContextFactoryForTests(allow_test_contexts); 115 ui::InitializeContextFactoryForTests(allow_test_contexts);
116 116
117 aura::Env::CreateInstance(); 117 aura::Env::CreateInstance();
118 scoped_ptr<aura::TestScreen> test_screen(aura::TestScreen::Create()); 118 scoped_ptr<aura::TestScreen> test_screen(aura::TestScreen::Create());
119 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get()); 119 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get());
120 scoped_ptr<aura::RootWindow> root_window( 120 scoped_ptr<aura::RootWindow> root_window(
121 test_screen->CreateRootWindowForPrimaryDisplay()); 121 test_screen->CreateRootWindowForPrimaryDisplay());
122 scoped_ptr<DemoWindowTreeClient> window_tree_client(new DemoWindowTreeClient( 122 scoped_ptr<DemoWindowTreeClient> window_tree_client(new DemoWindowTreeClient(
123 root_window.get())); 123 root_window.get()));
124 aura::test::TestFocusClient focus_client; 124 aura::test::TestFocusClient focus_client;
125 aura::client::SetFocusClient(root_window.get(), &focus_client); 125 aura::client::SetFocusClient(root_window.get(), &focus_client);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 // The exit manager is in charge of calling the dtors of singleton objects. 165 // The exit manager is in charge of calling the dtors of singleton objects.
166 base::AtExitManager exit_manager; 166 base::AtExitManager exit_manager;
167 167
168 ui::RegisterPathProvider(); 168 ui::RegisterPathProvider();
169 base::i18n::InitializeICU(); 169 base::i18n::InitializeICU();
170 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); 170 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
171 171
172 return DemoMain(); 172 return DemoMain();
173 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698