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

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

Issue 7720020: Get views_unittests pass on touch build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: enable TouchSelectionControllerImplTest as they're fixed Created 9 years, 4 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 | « views/test/views_test_base.h ('k') | views/touchui/touch_selection_controller_impl_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
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 namespace views { 11 namespace views {
12 12
13 ViewsTestBase::ViewsTestBase() { 13 ViewsTestBase::ViewsTestBase()
14 : setup_called_(false),
15 teardown_called_(false) {
14 #if defined(OS_WIN) 16 #if defined(OS_WIN)
15 OleInitialize(NULL); 17 OleInitialize(NULL);
16 #endif 18 #endif
17 } 19 }
18 20
19 ViewsTestBase::~ViewsTestBase() { 21 ViewsTestBase::~ViewsTestBase() {
20 #if defined(OS_WIN) 22 #if defined(OS_WIN)
21 OleUninitialize(); 23 OleUninitialize();
22 #endif 24 #endif
25 CHECK(setup_called_)
26 << "You have overridden SetUp but never called super class's SetUp";
27 CHECK(teardown_called_)
28 << "You have overrideen TearDown but never called super class's TearDown";
29 }
30
31 void ViewsTestBase::SetUp() {
32 testing::Test::SetUp();
33 setup_called_ = true;
34 if (!views_delegate_.get())
35 views_delegate_.reset(new TestViewsDelegate());
23 } 36 }
24 37
25 void ViewsTestBase::TearDown() { 38 void ViewsTestBase::TearDown() {
26 // Flush the message loop because we have pending release tasks 39 // Flush the message loop because we have pending release tasks
27 // and these tasks if un-executed would upset Valgrind. 40 // and these tasks if un-executed would upset Valgrind.
28 RunPendingMessages(); 41 RunPendingMessages();
42 teardown_called_ = true;
43 views_delegate_.reset();
44 testing::Test::TearDown();
29 } 45 }
30 46
31 } // namespace views 47 } // namespace views
OLDNEW
« no previous file with comments | « views/test/views_test_base.h ('k') | views/touchui/touch_selection_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698