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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 class ViewEventTestBase : public views::WidgetDelegate, | 78 class ViewEventTestBase : public views::WidgetDelegate, |
79 public testing::Test { | 79 public testing::Test { |
80 public: | 80 public: |
81 ViewEventTestBase(); | 81 ViewEventTestBase(); |
82 | 82 |
83 // Invoke when done either because of failure or success. Quits the message | 83 // Invoke when done either because of failure or success. Quits the message |
84 // loop. | 84 // loop. |
85 void Done(); | 85 void Done(); |
86 | 86 |
| 87 static void SetUpTestCase(); |
| 88 |
87 // Creates a window. | 89 // Creates a window. |
88 virtual void SetUp() OVERRIDE; | 90 virtual void SetUp() OVERRIDE; |
89 | 91 |
90 // Destroys the window. | 92 // Destroys the window. |
91 virtual void TearDown() OVERRIDE; | 93 virtual void TearDown() OVERRIDE; |
92 | 94 |
93 // Overridden from views::WidgetDelegate: | 95 // Overridden from views::WidgetDelegate: |
94 virtual bool CanResize() const OVERRIDE; | 96 virtual bool CanResize() const OVERRIDE; |
95 virtual views::View* GetContentsView() OVERRIDE; | 97 virtual views::View* GetContentsView() OVERRIDE; |
96 virtual const views::Widget* GetWidget() const OVERRIDE; | 98 virtual const views::Widget* GetWidget() const OVERRIDE; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Convenience macro for defining a ViewEventTestBase. See class description | 167 // Convenience macro for defining a ViewEventTestBase. See class description |
166 // of ViewEventTestBase for details. | 168 // of ViewEventTestBase for details. |
167 #define VIEW_TEST(test_class, name) \ | 169 #define VIEW_TEST(test_class, name) \ |
168 TEST_F(test_class, name) {\ | 170 TEST_F(test_class, name) {\ |
169 StartMessageLoopAndRunTest();\ | 171 StartMessageLoopAndRunTest();\ |
170 } | 172 } |
171 | 173 |
172 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) | 174 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) |
173 | 175 |
174 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ | 176 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ |
OLD | NEW |