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

Side by Side Diff: views/test/views_test_base.cc

Issue 8240006: Use a mocked compositor for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 9 years, 2 months 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) 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 "views/test/views_test_base.h" 5 #include "views/test/views_test_base.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <ole2.h> 8 #include <ole2.h>
9 #endif 9 #endif
10 10
11 #include "ui/gfx/compositor/test_compositor.h" 11 #include "ui/gfx/compositor/test_compositor.h"
12 #include "views/widget/widget.h" 12 #include "views/widget/widget.h"
13 13
14 #if defined(USE_AURA) 14 #if defined(USE_AURA)
15 #include "ui/aura/desktop.h" 15 #include "ui/aura/desktop.h"
16 #include "ui/aura/test/test_desktop_delegate.h" 16 #include "ui/aura/test/test_desktop_delegate.h"
17 #endif 17 #endif
18 18
19 namespace views { 19 namespace views {
20 20
21 static ui::Compositor* TestCreateCompositor() { 21 static ui::Compositor* TestCreateCompositor(ui::CompositorDelegate *owner) {
22 return new ui::TestCompositor(); 22 return new ui::TestCompositor(owner);
23 } 23 }
24 24
25 ViewsTestBase::ViewsTestBase() 25 ViewsTestBase::ViewsTestBase()
26 : setup_called_(false), 26 : setup_called_(false),
27 teardown_called_(false) { 27 teardown_called_(false) {
28 #if defined(OS_WIN) 28 #if defined(OS_WIN)
29 OleInitialize(NULL); 29 OleInitialize(NULL);
30 #endif 30 #endif
31 #if defined(USE_AURA) 31 #if defined(USE_AURA)
32 aura::Desktop::set_compositor_factory_for_testing(&TestCreateCompositor); 32 aura::Desktop::set_compositor_factory_for_testing(&TestCreateCompositor);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void ViewsTestBase::RunPendingMessages() { 70 void ViewsTestBase::RunPendingMessages() {
71 #if defined(USE_AURA) 71 #if defined(USE_AURA)
72 message_loop_.RunAllPendingWithDispatcher( 72 message_loop_.RunAllPendingWithDispatcher(
73 aura::Desktop::GetInstance()->GetDispatcher()); 73 aura::Desktop::GetInstance()->GetDispatcher());
74 #else 74 #else
75 message_loop_.RunAllPending(); 75 message_loop_.RunAllPending();
76 #endif 76 #endif
77 } 77 }
78 78
79 } // namespace views 79 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698