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

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

Issue 8581003: views: Move ime and test directories to ui/views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux 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 | « views/test/views_test_base.h ('k') | views/view_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 "views/test/views_test_base.h"
6
7 #if defined(OS_WIN)
8 #include <ole2.h>
9 #endif
10
11 #if defined(USE_AURA)
12 #include "ui/aura/desktop.h"
13 #include "ui/aura/test/test_stacking_client.h"
14 #endif
15
16 namespace views {
17
18 ViewsTestBase::ViewsTestBase()
19 : setup_called_(false),
20 teardown_called_(false) {
21 #if defined(OS_WIN)
22 OleInitialize(NULL);
23 #endif
24 #if defined(USE_AURA)
25 new aura::test::TestStackingClient;
26 #endif
27 }
28
29 ViewsTestBase::~ViewsTestBase() {
30 #if defined(OS_WIN)
31 OleUninitialize();
32 #endif
33 CHECK(setup_called_)
34 << "You have overridden SetUp but never called super class's SetUp";
35 CHECK(teardown_called_)
36 << "You have overrideen TearDown but never called super class's TearDown";
37 }
38
39 void ViewsTestBase::SetUp() {
40 testing::Test::SetUp();
41 setup_called_ = true;
42 if (!views_delegate_.get())
43 views_delegate_.reset(new TestViewsDelegate());
44 }
45
46 void ViewsTestBase::TearDown() {
47 // Flush the message loop because we have pending release tasks
48 // and these tasks if un-executed would upset Valgrind.
49 RunPendingMessages();
50 teardown_called_ = true;
51 views_delegate_.reset();
52 testing::Test::TearDown();
53 }
54
55 void ViewsTestBase::RunPendingMessages() {
56 #if defined(USE_AURA)
57 message_loop_.RunAllPendingWithDispatcher(
58 aura::Desktop::GetInstance()->GetDispatcher());
59 #else
60 message_loop_.RunAllPending();
61 #endif
62 }
63
64 } // namespace views
OLDNEW
« no previous file with comments | « views/test/views_test_base.h ('k') | views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698