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

Side by Side Diff: ui/gfx/compositor/compositor_test_support.cc

Issue 8404041: Revert 107563 - Fix up compositor mocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
« no previous file with comments | « ui/gfx/compositor/compositor_test_support.h ('k') | ui/gfx/test/gfx_test_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/gfx/compositor/compositor_test_support.h" 5 #include "ui/gfx/compositor/compositor_test_support.h"
6 6
7 #if defined(USE_WEBKIT_COMPOSITOR) 7 #if defined(USE_WEBKIT_COMPOSITOR)
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
9 #include "webkit/glue/webkitplatformsupport_impl.h" 9 #include "webkit/glue/webkitplatformsupport_impl.h"
10 #endif 10 #endif
11 11
12 #if defined(VIEWS_COMPOSITOR)
13 #include "ui/gfx/compositor/compositor.h"
14 #include "ui/gfx/compositor/test_compositor.h"
15 #endif
16
12 namespace ui { 17 namespace ui {
13 18
14 #if defined(USE_WEBKIT_COMPOSITOR) 19 #if defined(USE_WEBKIT_COMPOSITOR)
15 static webkit_glue::WebKitPlatformSupportImpl* g_webkit_support; 20 static webkit_glue::WebKitPlatformSupportImpl* g_webkit_support;
16 #endif 21 #endif
17 22
18 void CompositorTestSupport::Initialize() { 23 void CompositorTestSupport::Initialize() {
19 #if defined(USE_WEBKIT_COMPOSITOR) 24 #if defined(USE_WEBKIT_COMPOSITOR)
20 DCHECK(!g_webkit_support); 25 DCHECK(!g_webkit_support);
21 g_webkit_support = new webkit_glue::WebKitPlatformSupportImpl; 26 g_webkit_support = new webkit_glue::WebKitPlatformSupportImpl;
22 WebKit::initialize(g_webkit_support); 27 WebKit::initialize(g_webkit_support);
23 #endif 28 #endif
24 } 29 }
25 30
26 void CompositorTestSupport::Terminate() { 31 void CompositorTestSupport::Terminate() {
27 #if defined(USE_WEBKIT_COMPOSITOR) 32 #if defined(USE_WEBKIT_COMPOSITOR)
28 DCHECK(g_webkit_support); 33 DCHECK(g_webkit_support);
29 WebKit::shutdown(); 34 WebKit::shutdown();
30 delete g_webkit_support; 35 delete g_webkit_support;
31 g_webkit_support = NULL; 36 g_webkit_support = NULL;
32 #endif 37 #endif
33 } 38 }
34 39
40 void CompositorTestSupport::SetupMockCompositor() {
41 #if defined(USE_WEBKIT_COMPOSITOR)
42 // TODO(backer): We've got dependencies in Layer that require
43 // WebKit support even though we're mocking the Compositor. We
44 // would ideally mock out these unnecessary dependencies as well.
45 DCHECK(g_webkit_support);
46 #endif
47
48 #if defined(VIEWS_COMPOSITOR)
49 // Use a mock compositor that noops draws.
50 ui::Compositor::set_compositor_factory_for_testing(
51 ui::TestCompositor::Create);
52 #endif
53 }
54
35 } // namespace ui 55 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/compositor/compositor_test_support.h ('k') | ui/gfx/test/gfx_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698