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/thread.h" | 9 #include "base/thread.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
75 // WindowDelegate method. Calls into CreateContentsView to get the actual | 75 // WindowDelegate method. Calls into CreateContentsView to get the actual |
76 // view. | 76 // view. |
77 virtual views::View* GetContentsView(); | 77 virtual views::View* GetContentsView(); |
78 | 78 |
79 // Overriden to do nothing so that this class can be used in runnable tasks. | 79 // Overriden to do nothing so that this class can be used in runnable tasks. |
80 void AddRef() {} | 80 void AddRef() {} |
81 void Release() {} | 81 void Release() {} |
82 static bool ImplementsThreadSafeReferenceCounting() { return false; } | |
83 | 82 |
84 protected: | 83 protected: |
85 // Returns the view that is added to the window. | 84 // Returns the view that is added to the window. |
86 virtual views::View* CreateContentsView() = 0; | 85 virtual views::View* CreateContentsView() = 0; |
87 | 86 |
88 // Called once the message loop is running. | 87 // Called once the message loop is running. |
89 virtual void DoTestOnMessageLoop() = 0; | 88 virtual void DoTestOnMessageLoop() = 0; |
90 | 89 |
91 // Invoke from test main. Shows the window, starts the message loop and | 90 // Invoke from test main. Shows the window, starts the message loop and |
92 // schedules a task that invokes DoTestOnMessageLoop. | 91 // schedules a task that invokes DoTestOnMessageLoop. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 }; | 130 }; |
132 | 131 |
133 // Convenience macro for defining a ViewEventTestBase. See class description | 132 // Convenience macro for defining a ViewEventTestBase. See class description |
134 // of ViewEventTestBase for details. | 133 // of ViewEventTestBase for details. |
135 #define VIEW_TEST(test_class, name) \ | 134 #define VIEW_TEST(test_class, name) \ |
136 TEST_F(test_class, name) {\ | 135 TEST_F(test_class, name) {\ |
137 StartMessageLoopAndRunTest();\ | 136 StartMessageLoopAndRunTest();\ |
138 } | 137 } |
139 | 138 |
140 #endif // CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ | 139 #endif // CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ |
OLD | NEW |