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

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

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, 3 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/focus/focus_manager_unittest.cc ('k') | views/test/views_test_base.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 #ifndef VIEWS_TEST_VIEWS_TEST_BASE_H_ 5 #ifndef VIEWS_TEST_VIEWS_TEST_BASE_H_
6 #define VIEWS_TEST_VIEWS_TEST_BASE_H_ 6 #define VIEWS_TEST_VIEWS_TEST_BASE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/scoped_ptr.h"
12 #include "views/test/test_views_delegate.h" 13 #include "views/test/test_views_delegate.h"
13 14
14 namespace views { 15 namespace views {
15 16
17 class TestViewsDelegate;
18
16 // A base class for views unit test. It creates a message loop necessary 19 // A base class for views unit test. It creates a message loop necessary
17 // to drive UI events and takes care of OLE initialization for windows. 20 // to drive UI events and takes care of OLE initialization for windows.
18 class ViewsTestBase : public testing::Test { 21 class ViewsTestBase : public testing::Test {
19 public: 22 public:
20 ViewsTestBase(); 23 ViewsTestBase();
21 virtual ~ViewsTestBase(); 24 virtual ~ViewsTestBase();
22 25
23 // testing::Test: 26 // testing::Test:
24 virtual void TearDown(); 27 virtual void SetUp() OVERRIDE;
28 virtual void TearDown() OVERRIDE;
25 29
26 void RunPendingMessages() { 30 void RunPendingMessages() {
27 message_loop_.RunAllPending(); 31 message_loop_.RunAllPending();
28 } 32 }
29 33
30 protected: 34 protected:
31 TestViewsDelegate& views_delegate() { return views_delegate_; } 35 TestViewsDelegate& views_delegate() const { return *views_delegate_.get(); }
36
37 void set_views_delegate(TestViewsDelegate* views_delegate) {
38 views_delegate_.reset(views_delegate);
39 }
32 40
33 private: 41 private:
34 MessageLoopForUI message_loop_; 42 MessageLoopForUI message_loop_;
35 TestViewsDelegate views_delegate_; 43 scoped_ptr<TestViewsDelegate> views_delegate_;
44 bool setup_called_;
45 bool teardown_called_;
36 46
37 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); 47 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase);
38 }; 48 };
39 49
40 } // namespace views 50 } // namespace views
41 51
42 #endif // VIEWS_TEST_VIEWS_TEST_BASE_H_ 52 #endif // VIEWS_TEST_VIEWS_TEST_BASE_H_
OLDNEW
« no previous file with comments | « views/focus/focus_manager_unittest.cc ('k') | views/test/views_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698