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

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

Issue 9664069: Move scoped_ole_initializer.h to ui/base/win and clean up ole initialization/uninitialization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
« no previous file with comments | « chrome/test/base/chrome_test_suite.h ('k') | chrome/test/base/view_event_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #pragma once 7 #pragma once
8 8
9 // We only want to use ViewEventTestBase in test targets which properly 9 // We only want to use ViewEventTestBase in test targets which properly
10 // isolate each test case by running each test in a separate process. 10 // isolate each test case by running each test in a separate process.
11 // This way if a test hangs the test launcher can reliably terminate it. 11 // This way if a test hangs the test launcher can reliably terminate it.
12 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER) 12 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER)
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/message_loop.h" 17 #include "base/message_loop.h"
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "content/test/test_browser_thread.h" 19 #include "content/test/test_browser_thread.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)
24 #include "ui/base/win/scoped_ole_initializer.h"
25 #endif
26
23 namespace gfx { 27 namespace gfx {
24 class Size; 28 class Size;
25 } 29 }
26 30
27 // Base class for Views based tests that dispatch events. 31 // Base class for Views based tests that dispatch events.
28 // 32 //
29 // As views based event test involves waiting for events to be processed, 33 // As views based event test involves waiting for events to be processed,
30 // writing a views based test is slightly different than that of writing 34 // writing a views based test is slightly different than that of writing
31 // other unit tests. In particular when the test fails or is done you need 35 // other unit tests. In particular when the test fails or is done you need
32 // to stop the message loop. This can be done by way of invoking the Done 36 // to stop the message loop. This can be done by way of invoking the Done
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // The content of the Window. 134 // The content of the Window.
131 views::View* content_view_; 135 views::View* content_view_;
132 136
133 // Thread for posting background MouseMoves. 137 // Thread for posting background MouseMoves.
134 scoped_ptr<base::Thread> dnd_thread_; 138 scoped_ptr<base::Thread> dnd_thread_;
135 139
136 MessageLoopForUI message_loop_; 140 MessageLoopForUI message_loop_;
137 141
138 content::TestBrowserThread ui_thread_; 142 content::TestBrowserThread ui_thread_;
139 143
144 #if defined(OS_WIN)
145 ui::ScopedOleInitializer ole_initializer_;
146 #endif
147
140 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase); 148 DISALLOW_COPY_AND_ASSIGN(ViewEventTestBase);
141 }; 149 };
142 150
143 // Convenience macro for defining a ViewEventTestBase. See class description 151 // Convenience macro for defining a ViewEventTestBase. See class description
144 // of ViewEventTestBase for details. 152 // of ViewEventTestBase for details.
145 #define VIEW_TEST(test_class, name) \ 153 #define VIEW_TEST(test_class, name) \
146 TEST_F(test_class, name) {\ 154 TEST_F(test_class, name) {\
147 StartMessageLoopAndRunTest();\ 155 StartMessageLoopAndRunTest();\
148 } 156 }
149 157
150 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) 158 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER)
151 159
152 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_ 160 #endif // CHROME_TEST_BASE_VIEW_EVENT_TEST_BASE_H_
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_test_suite.h ('k') | chrome/test/base/view_event_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698