| 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/thread.h" | 10 #include "base/thread.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "views/window/window_delegate.h" | 12 #include "views/window/window_delegate.h" |
| 12 | 13 |
| 13 class Task; | 14 class Task; |
| 14 | 15 |
| 15 namespace gfx { | 16 namespace gfx { |
| 16 class Size; | 17 class Size; |
| 17 } | 18 } |
| 18 | 19 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 views::Window* window_; | 113 views::Window* window_; |
| 113 | 114 |
| 114 private: | 115 private: |
| 115 // Stops the thread started by ScheduleMouseMoveInBackground. | 116 // Stops the thread started by ScheduleMouseMoveInBackground. |
| 116 void StopBackgroundThread(); | 117 void StopBackgroundThread(); |
| 117 | 118 |
| 118 // Callback from CreateEventTask. Stops the background thread, runs the | 119 // Callback from CreateEventTask. Stops the background thread, runs the |
| 119 // supplied task and if there are failures invokes Done. | 120 // supplied task and if there are failures invokes Done. |
| 120 void RunTestMethod(Task* task); | 121 void RunTestMethod(Task* task); |
| 121 | 122 |
| 123 // Called when the test has been running for longer than expected. |
| 124 void TimedOut(); |
| 125 |
| 122 // The content of the Window. | 126 // The content of the Window. |
| 123 views::View* content_view_; | 127 views::View* content_view_; |
| 124 | 128 |
| 125 // Thread for posting background MouseMoves. | 129 // Thread for posting background MouseMoves. |
| 126 scoped_ptr<base::Thread> dnd_thread_; | 130 scoped_ptr<base::Thread> dnd_thread_; |
| 127 | 131 |
| 128 MessageLoopForUI message_loop_; | 132 MessageLoopForUI message_loop_; |
| 129 | 133 |
| 134 // Method factory used for time-outs. |
| 135 ScopedRunnableMethodFactory<ViewEventTestBase> method_factory_; |
| 136 |
| 130 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); | 137 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); |
| 131 }; | 138 }; |
| 132 | 139 |
| 133 // Convenience macro for defining a ViewEventTestBase. See class description | 140 // Convenience macro for defining a ViewEventTestBase. See class description |
| 134 // of ViewEventTestBase for details. | 141 // of ViewEventTestBase for details. |
| 135 #define VIEW_TEST(test_class, name) \ | 142 #define VIEW_TEST(test_class, name) \ |
| 136 TEST_F(test_class, name) {\ | 143 TEST_F(test_class, name) {\ |
| 137 StartMessageLoopAndRunTest();\ | 144 StartMessageLoopAndRunTest();\ |
| 138 } | 145 } |
| 139 | 146 |
| 140 #endif // CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ | 147 #endif // CHROME_TEST_INTERACTIVE_UI_VIEW_EVENT_TEST_BASE_H_ |
| OLD | NEW |