| 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 views { |
| 38 namespace corewm { |
| 39 class WMState; |
| 40 } |
| 41 } |
| 42 |
| 37 // Base class for Views based tests that dispatch events. | 43 // Base class for Views based tests that dispatch events. |
| 38 // | 44 // |
| 39 // As views based event test involves waiting for events to be processed, | 45 // As views based event test involves waiting for events to be processed, |
| 40 // writing a views based test is slightly different than that of writing | 46 // writing a views based test is slightly different than that of writing |
| 41 // other unit tests. In particular when the test fails or is done you need | 47 // other unit tests. In particular when the test fails or is done you need |
| 42 // to stop the message loop. This can be done by way of invoking the Done | 48 // to stop the message loop. This can be done by way of invoking the Done |
| 43 // method. | 49 // method. |
| 44 // | 50 // |
| 45 // Any delayed callbacks should be done by way of CreateEventTask. | 51 // Any delayed callbacks should be done by way of CreateEventTask. |
| 46 // CreateEventTask checks to see if ASSERT_XXX has been invoked after invoking | 52 // CreateEventTask checks to see if ASSERT_XXX has been invoked after invoking |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 scoped_ptr<base::Thread> dnd_thread_; | 149 scoped_ptr<base::Thread> dnd_thread_; |
| 144 | 150 |
| 145 content::TestBrowserThreadBundle thread_bundle_; | 151 content::TestBrowserThreadBundle thread_bundle_; |
| 146 | 152 |
| 147 #if defined(OS_WIN) | 153 #if defined(OS_WIN) |
| 148 ui::ScopedOleInitializer ole_initializer_; | 154 ui::ScopedOleInitializer ole_initializer_; |
| 149 #endif | 155 #endif |
| 150 | 156 |
| 151 #if defined(USE_AURA) | 157 #if defined(USE_AURA) |
| 152 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 158 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
| 159 scoped_ptr<views::corewm::WMState> wm_state_; |
| 153 #endif | 160 #endif |
| 154 | 161 |
| 155 ChromeViewsDelegate views_delegate_; | 162 ChromeViewsDelegate views_delegate_; |
| 156 | 163 |
| 157 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); | 164 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); |
| 158 }; | 165 }; |
| 159 | 166 |
| 160 // Convenience macro for defining a ViewEventTestBase. See class description | 167 // Convenience macro for defining a ViewEventTestBase. See class description |
| 161 // of ViewEventTestBase for details. | 168 // of ViewEventTestBase for details. |
| 162 #define VIEW_TEST(test_class, name) \ | 169 #define VIEW_TEST(test_class, name) \ |
| 163 TEST_F(test_class, name) {\ | 170 TEST_F(test_class, name) {\ |
| 164 StartMessageLoopAndRunTest();\ | 171 StartMessageLoopAndRunTest();\ |
| 165 } | 172 } |
| 166 | 173 |
| 167 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) | 174 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) |
| 168 | 175 |
| 169 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ | 176 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ |
| OLD | NEW |