OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ | 5 #ifndef UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
6 #define UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ | 6 #define UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 ViewsTestBase(); | 29 ViewsTestBase(); |
30 virtual ~ViewsTestBase(); | 30 virtual ~ViewsTestBase(); |
31 | 31 |
32 // testing::Test: | 32 // testing::Test: |
33 virtual void SetUp() OVERRIDE; | 33 virtual void SetUp() OVERRIDE; |
34 virtual void TearDown() OVERRIDE; | 34 virtual void TearDown() OVERRIDE; |
35 | 35 |
36 void RunPendingMessages(); | 36 void RunPendingMessages(); |
37 | 37 |
| 38 // Creates a widget of |type| with any platform specific data for use in |
| 39 // cross-platform tests. |
| 40 Widget::InitParams CreateParams(Widget::InitParams::Type type); |
| 41 |
38 protected: | 42 protected: |
39 TestViewsDelegate& views_delegate() const { return *views_delegate_.get(); } | 43 TestViewsDelegate& views_delegate() const { return *views_delegate_.get(); } |
40 | 44 |
41 void set_views_delegate(TestViewsDelegate* views_delegate) { | 45 void set_views_delegate(TestViewsDelegate* views_delegate) { |
42 views_delegate_.reset(views_delegate); | 46 views_delegate_.reset(views_delegate); |
43 } | 47 } |
44 | 48 |
45 MessageLoop* message_loop() { return &message_loop_; } | 49 MessageLoop* message_loop() { return &message_loop_; } |
46 | 50 |
47 // Creates a widget of |type| with any platform specific data for use in | |
48 // cross-platform tests. | |
49 Widget::InitParams CreateParams(Widget::InitParams::Type type); | |
50 | |
51 // Returns a context view. In aura builds, this will be the | 51 // Returns a context view. In aura builds, this will be the |
52 // RootWindow. Everywhere else, NULL. | 52 // RootWindow. Everywhere else, NULL. |
53 gfx::NativeView GetContext(); | 53 gfx::NativeView GetContext(); |
54 | 54 |
55 private: | 55 private: |
56 MessageLoopForUI message_loop_; | 56 MessageLoopForUI message_loop_; |
57 scoped_ptr<TestViewsDelegate> views_delegate_; | 57 scoped_ptr<TestViewsDelegate> views_delegate_; |
58 #if defined(USE_AURA) | 58 #if defined(USE_AURA) |
59 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 59 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
60 #endif | 60 #endif |
61 bool setup_called_; | 61 bool setup_called_; |
62 bool teardown_called_; | 62 bool teardown_called_; |
63 | 63 |
64 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
65 ui::ScopedOleInitializer ole_initializer_; | 65 ui::ScopedOleInitializer ole_initializer_; |
66 #endif | 66 #endif |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); | 68 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); |
69 }; | 69 }; |
70 | 70 |
71 } // namespace views | 71 } // namespace views |
72 | 72 |
73 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ | 73 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
OLD | NEW |