Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chrome/test/base/view_event_test_base.h

Issue 443553003: MacViews: Split ViewEventTestBase into platform-specific files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.
11 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER) 11 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER)
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "chrome/browser/ui/views/chrome_views_delegate.h" 18 #include "chrome/browser/ui/views/chrome_views_delegate.h"
19 #include "content/public/test/test_browser_thread_bundle.h" 19 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "ui/views/widget/widget_delegate.h" 21 #include "ui/views/widget/widget_delegate.h"
22 22
23 #if defined(OS_WIN) 23 #if defined(OS_WIN)
24 #include "ui/base/win/scoped_ole_initializer.h" 24 #include "ui/base/win/scoped_ole_initializer.h"
25 #endif 25 #endif
26 26
27 namespace aura {
28 namespace test {
29 class AuraTestHelper;
30 }
31 }
32
33 namespace gfx { 27 namespace gfx {
34 class Size; 28 class Size;
35 } 29 }
36 30
37 namespace wm { 31 class ChromeViewsTestHelper;
38 class WMState;
39 }
40 32
41 // Base class for Views based tests that dispatch events. 33 // Base class for Views based tests that dispatch events.
42 // 34 //
43 // As views based event test involves waiting for events to be processed, 35 // As views based event test involves waiting for events to be processed,
44 // writing a views based test is slightly different than that of writing 36 // writing a views based test is slightly different than that of writing
45 // other unit tests. In particular when the test fails or is done you need 37 // other unit tests. In particular when the test fails or is done you need
46 // to stop the message loop. This can be done by way of invoking the Done 38 // to stop the message loop. This can be done by way of invoking the Done
47 // method. 39 // method.
48 // 40 //
49 // Any delayed callbacks should be done by way of CreateEventTask. 41 // Any delayed callbacks should be done by way of CreateEventTask.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 139
148 // Thread for posting background MouseMoves. 140 // Thread for posting background MouseMoves.
149 scoped_ptr<base::Thread> dnd_thread_; 141 scoped_ptr<base::Thread> dnd_thread_;
150 142
151 content::TestBrowserThreadBundle thread_bundle_; 143 content::TestBrowserThreadBundle thread_bundle_;
152 144
153 #if defined(OS_WIN) 145 #if defined(OS_WIN)
154 ui::ScopedOleInitializer ole_initializer_; 146 ui::ScopedOleInitializer ole_initializer_;
155 #endif 147 #endif
156 148
157 #if defined(USE_AURA) 149 scoped_ptr<ChromeViewsTestHelper> chrome_views_test_helper_;
158 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_;
159 scoped_ptr<wm::WMState> wm_state_;
160 #endif
161 150
162 ChromeViewsDelegate views_delegate_; 151 ChromeViewsDelegate views_delegate_;
163 152
164 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); 153 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase);
165 }; 154 };
166 155
167 // Convenience macro for defining a ViewEventTestBase. See class description 156 // Convenience macro for defining a ViewEventTestBase. See class description
168 // of ViewEventTestBase for details. 157 // of ViewEventTestBase for details.
169 #define VIEW_TEST(test_class, name) \ 158 #define VIEW_TEST(test_class, name) \
170 TEST_F(test_class, name) {\ 159 TEST_F(test_class, name) {\
171 StartMessageLoopAndRunTest();\ 160 StartMessageLoopAndRunTest();\
172 } 161 }
173 162
174 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) 163 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER)
175 164
176 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ 165 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698