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

Side by Side Diff: ui/aura/aura_test_base.cc

Issue 8202014: Fixes aura build on windows. Makes all tests use the test compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks 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
« no previous file with comments | « ui/aura/aura_test_base.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/aura/aura_test_base.h"
6
7 #if defined(OS_WIN)
8 #include <ole2.h>
9 #endif
10
11 #include "ui/aura/desktop.h"
12 #include "ui/gfx/compositor/test_compositor.h"
13
14 namespace aura {
15
16 static ui::Compositor* TestCreateCompositor() {
17 return new ui::TestCompositor();
18 }
19
20 AuraTestBase::AuraTestBase()
21 : setup_called_(false),
22 teardown_called_(false) {
23 #if defined(OS_WIN)
24 OleInitialize(NULL);
25 #endif
26 }
27
28 AuraTestBase::~AuraTestBase() {
29 #if defined(OS_WIN)
30 OleUninitialize();
31 #endif
32 CHECK(setup_called_)
33 << "You have overridden SetUp but never called super class's SetUp";
34 CHECK(teardown_called_)
35 << "You have overrideen TearDown but never called super class's TearDown";
36 }
37
38 void AuraTestBase::SetUp() {
39 testing::Test::SetUp();
40 setup_called_ = true;
41 aura::Desktop::set_compositor_factory_for_testing(&TestCreateCompositor);
42 if (!aura::Desktop::GetInstance()->default_parent())
43 aura::Desktop::GetInstance()->CreateDefaultParentForTesting();
44 Desktop::GetInstance()->Show();
45 Desktop::GetInstance()->SetSize(gfx::Size(500, 500));
46 }
47
48 void AuraTestBase::TearDown() {
49 // Flush the message loop because we have pending release tasks
50 // and these tasks if un-executed would upset Valgrind.
51 RunPendingMessages();
52 teardown_called_ = true;
53 testing::Test::TearDown();
54 aura::Desktop::set_compositor_factory_for_testing(NULL);
55 }
56
57 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/aura_test_base.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698