| 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; } |
| 82 | 83 |
| 83 protected: | 84 protected: |
| 84 // Returns the view that is added to the window. | 85 // Returns the view that is added to the window. |
| 85 virtual views::View* CreateContentsView() = 0; | 86 virtual views::View* CreateContentsView() = 0; |
| 86 | 87 |
| 87 // Called once the message loop is running. | 88 // Called once the message loop is running. |
| 88 virtual void DoTestOnMessageLoop() = 0; | 89 virtual void DoTestOnMessageLoop() = 0; |
| 89 | 90 |
| 90 // Invoke from test main. Shows the window, starts the message loop and | 91 // Invoke from test main. Shows the window, starts the message loop and |
| 91 // schedules a task that invokes DoTestOnMessageLoop. | 92 // schedules a task that invokes DoTestOnMessageLoop. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 // Convenience macro for defining a ViewEventTestBase. See class description | 133 // Convenience macro for defining a ViewEventTestBase. See class description |
| 133 // of ViewEventTestBase for details. | 134 // of ViewEventTestBase for details. |
| 134 #define VIEW_TEST(test_class, name) \ | 135 #define VIEW_TEST(test_class, name) \ |
| 135 TEST_F(test_class, name) {\ | 136 TEST_F(test_class, name) {\ |
| 136 StartMessageLoopAndRunTest();\ | 137 StartMessageLoopAndRunTest();\ |
| 137 } | 138 } |
| 138 | 139 |
| 139 #endif // CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ | 140 #endif // CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ |
| OLD | NEW |