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 CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ | 5 #ifndef CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ |
6 #define CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ | 6 #define CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ |
7 | 7 |
8 // We only want to use ViewEventTestBase in test targets which properly | 8 // We only want to use ViewEventTestBase in test targets which properly |
9 // isolate each test case by running each test in a separate process. | 9 // isolate each test case by running each test in a separate process. |
10 // This way if a test hangs the test launcher can reliably terminate it. | 10 // This way if a test hangs the test launcher can reliably terminate it. |
(...skipping 16 matching lines...) Expand all Loading... |
27 namespace aura { | 27 namespace aura { |
28 namespace test { | 28 namespace test { |
29 class AuraTestHelper; | 29 class AuraTestHelper; |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 namespace gfx { | 33 namespace gfx { |
34 class Size; | 34 class Size; |
35 } | 35 } |
36 | 36 |
| 37 namespace ui { |
| 38 class PlatformEventSource; |
| 39 } |
| 40 |
37 namespace wm { | 41 namespace wm { |
38 class WMState; | 42 class WMState; |
39 } | 43 } |
40 | 44 |
41 // Base class for Views based tests that dispatch events. | 45 // Base class for Views based tests that dispatch events. |
42 // | 46 // |
43 // As views based event test involves waiting for events to be processed, | 47 // As views based event test involves waiting for events to be processed, |
44 // writing a views based test is slightly different than that of writing | 48 // writing a views based test is slightly different than that of writing |
45 // other unit tests. In particular when the test fails or is done you need | 49 // other unit tests. In particular when the test fails or is done you need |
46 // to stop the message loop. This can be done by way of invoking the Done | 50 // to stop the message loop. This can be done by way of invoking the Done |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 151 |
148 // Thread for posting background MouseMoves. | 152 // Thread for posting background MouseMoves. |
149 scoped_ptr<base::Thread> dnd_thread_; | 153 scoped_ptr<base::Thread> dnd_thread_; |
150 | 154 |
151 content::TestBrowserThreadBundle thread_bundle_; | 155 content::TestBrowserThreadBundle thread_bundle_; |
152 | 156 |
153 #if defined(OS_WIN) | 157 #if defined(OS_WIN) |
154 ui::ScopedOleInitializer ole_initializer_; | 158 ui::ScopedOleInitializer ole_initializer_; |
155 #endif | 159 #endif |
156 | 160 |
157 #if defined(USE_AURA) | |
158 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 161 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
159 scoped_ptr<wm::WMState> wm_state_; | 162 scoped_ptr<wm::WMState> wm_state_; |
160 #endif | 163 scoped_ptr<ui::PlatformEventSource> event_source_; |
161 | 164 |
162 ChromeViewsDelegate views_delegate_; | 165 ChromeViewsDelegate views_delegate_; |
163 | 166 |
164 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); | 167 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); |
165 }; | 168 }; |
166 | 169 |
167 // Convenience macro for defining a ViewEventTestBase. See class description | 170 // Convenience macro for defining a ViewEventTestBase. See class description |
168 // of ViewEventTestBase for details. | 171 // of ViewEventTestBase for details. |
169 #define VIEW_TEST(test_class, name) \ | 172 #define VIEW_TEST(test_class, name) \ |
170 TEST_F(test_class, name) {\ | 173 TEST_F(test_class, name) {\ |
171 StartMessageLoopAndRunTest();\ | 174 StartMessageLoopAndRunTest();\ |
172 } | 175 } |
173 | 176 |
174 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) | 177 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) |
175 | 178 |
176 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ | 179 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ |
OLD | NEW |