OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ | 5 #ifndef CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ |
6 #define CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ | 6 #define CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ |
7 | 7 |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "base/thread.h" | 10 #include "base/thread.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // WindowDelegate method. Calls into CreateContentsView to get the actual | 76 // WindowDelegate method. Calls into CreateContentsView to get the actual |
77 // view. | 77 // view. |
78 virtual views::View* GetContentsView(); | 78 virtual views::View* GetContentsView(); |
79 | 79 |
80 // Overriden to do nothing so that this class can be used in runnable tasks. | 80 // Overriden to do nothing so that this class can be used in runnable tasks. |
81 void AddRef() {} | 81 void AddRef() {} |
82 void Release() {} | 82 void Release() {} |
83 static bool ImplementsThreadSafeReferenceCounting() { return false; } | 83 static bool ImplementsThreadSafeReferenceCounting() { return false; } |
84 | 84 |
85 protected: | 85 protected: |
| 86 virtual ~ViewEventTestBase() {} |
| 87 |
86 // Returns the view that is added to the window. | 88 // Returns the view that is added to the window. |
87 virtual views::View* CreateContentsView() = 0; | 89 virtual views::View* CreateContentsView() = 0; |
88 | 90 |
89 // Called once the message loop is running. | 91 // Called once the message loop is running. |
90 virtual void DoTestOnMessageLoop() = 0; | 92 virtual void DoTestOnMessageLoop() = 0; |
91 | 93 |
92 // Invoke from test main. Shows the window, starts the message loop and | 94 // Invoke from test main. Shows the window, starts the message loop and |
93 // schedules a task that invokes DoTestOnMessageLoop. | 95 // schedules a task that invokes DoTestOnMessageLoop. |
94 void StartMessageLoopAndRunTest(); | 96 void StartMessageLoopAndRunTest(); |
95 | 97 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 }; | 140 }; |
139 | 141 |
140 // Convenience macro for defining a ViewEventTestBase. See class description | 142 // Convenience macro for defining a ViewEventTestBase. See class description |
141 // of ViewEventTestBase for details. | 143 // of ViewEventTestBase for details. |
142 #define VIEW_TEST(test_class, name) \ | 144 #define VIEW_TEST(test_class, name) \ |
143 TEST_F(test_class, name) {\ | 145 TEST_F(test_class, name) {\ |
144 StartMessageLoopAndRunTest();\ | 146 StartMessageLoopAndRunTest();\ |
145 } | 147 } |
146 | 148 |
147 #endif // CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ | 149 #endif // CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ |
OLD | NEW |