| OLD | NEW |
| 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 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 // We only want to use ViewEventTestBase in test targets which properly | 9 // We only want to use ViewEventTestBase in test targets which properly |
| 10 // isolate each test case by running each test in a separate process. | 10 // isolate each test case by running each test in a separate process. |
| 11 // This way if a test hangs the test launcher can reliably terminate it. | 11 // This way if a test hangs the test launcher can reliably terminate it. |
| 12 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER) | 12 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER) |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "views/widget/widget_delegate.h" | 19 #include "ui/views/widget/widget_delegate.h" |
| 20 | 20 |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 class Size; | 22 class Size; |
| 23 } | 23 } |
| 24 | 24 |
| 25 // Base class for Views based tests that dispatch events. | 25 // Base class for Views based tests that dispatch events. |
| 26 // | 26 // |
| 27 // As views based event test involves waiting for events to be processed, | 27 // As views based event test involves waiting for events to be processed, |
| 28 // writing a views based test is slightly different than that of writing | 28 // writing a views based test is slightly different than that of writing |
| 29 // other unit tests. In particular when the test fails or is done you need | 29 // other unit tests. In particular when the test fails or is done you need |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Convenience macro for defining a ViewEventTestBase. See class description | 142 // Convenience macro for defining a ViewEventTestBase. See class description |
| 143 // of ViewEventTestBase for details. | 143 // of ViewEventTestBase for details. |
| 144 #define VIEW_TEST(test_class, name) \ | 144 #define VIEW_TEST(test_class, name) \ |
| 145 TEST_F(test_class, name) {\ | 145 TEST_F(test_class, name) {\ |
| 146 StartMessageLoopAndRunTest();\ | 146 StartMessageLoopAndRunTest();\ |
| 147 } | 147 } |
| 148 | 148 |
| 149 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) | 149 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) |
| 150 | 150 |
| 151 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ | 151 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ |
| OLD | NEW |