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

Side by Side Diff: ppapi/proxy/ppapi_proxy_test.h

Issue 14273043: ppapi: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 7 years, 7 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 | « ppapi/proxy/plugin_main_nacl.cc ('k') | ppapi/proxy/ppapi_proxy_test.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 #include <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 class PluginProxyTest : public PluginProxyTestHarness, public testing::Test { 171 class PluginProxyTest : public PluginProxyTestHarness, public testing::Test {
172 public: 172 public:
173 PluginProxyTest(); 173 PluginProxyTest();
174 virtual ~PluginProxyTest(); 174 virtual ~PluginProxyTest();
175 175
176 // testing::Test implementation. 176 // testing::Test implementation.
177 virtual void SetUp(); 177 virtual void SetUp();
178 virtual void TearDown(); 178 virtual void TearDown();
179 private: 179 private:
180 MessageLoop message_loop_; 180 base::MessageLoop message_loop_;
181 }; 181 };
182 182
183 // This class provides support for multi-thread testing. A secondary thread is 183 // This class provides support for multi-thread testing. A secondary thread is
184 // created with a Pepper message loop. 184 // created with a Pepper message loop.
185 // Subclasses need to implement the two SetUpTestOn*Thread() methods to do the 185 // Subclasses need to implement the two SetUpTestOn*Thread() methods to do the
186 // actual testing work; and call both PostQuitFor*Thread() when testing is 186 // actual testing work; and call both PostQuitFor*Thread() when testing is
187 // done. 187 // done.
188 class PluginProxyMultiThreadTest 188 class PluginProxyMultiThreadTest
189 : public PluginProxyTest, 189 : public PluginProxyTest,
190 public base::DelegateSimpleThread::Delegate { 190 public base::DelegateSimpleThread::Delegate {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 294
295 class HostProxyTest : public HostProxyTestHarness, public testing::Test { 295 class HostProxyTest : public HostProxyTestHarness, public testing::Test {
296 public: 296 public:
297 HostProxyTest(); 297 HostProxyTest();
298 virtual ~HostProxyTest(); 298 virtual ~HostProxyTest();
299 299
300 // testing::Test implementation. 300 // testing::Test implementation.
301 virtual void SetUp(); 301 virtual void SetUp();
302 virtual void TearDown(); 302 virtual void TearDown();
303 private: 303 private:
304 MessageLoop message_loop_; 304 base::MessageLoop message_loop_;
305 }; 305 };
306 306
307 // Use this base class to test both sides of a proxy. 307 // Use this base class to test both sides of a proxy.
308 class TwoWayTest : public testing::Test { 308 class TwoWayTest : public testing::Test {
309 public: 309 public:
310 enum TwoWayTestMode { 310 enum TwoWayTestMode {
311 TEST_PPP_INTERFACE, 311 TEST_PPP_INTERFACE,
312 TEST_PPB_INTERFACE 312 TEST_PPB_INTERFACE
313 }; 313 };
314 TwoWayTest(TwoWayTestMode test_mode); 314 TwoWayTest(TwoWayTestMode test_mode);
(...skipping 17 matching lines...) Expand all
332 332
333 private: 333 private:
334 TwoWayTestMode test_mode_; 334 TwoWayTestMode test_mode_;
335 HostProxyTestHarness host_; 335 HostProxyTestHarness host_;
336 PluginProxyTestHarness plugin_; 336 PluginProxyTestHarness plugin_;
337 // In order to use sync IPC, we need to have an IO thread. 337 // In order to use sync IPC, we need to have an IO thread.
338 base::Thread io_thread_; 338 base::Thread io_thread_;
339 // The plugin side of the proxy runs on its own thread. 339 // The plugin side of the proxy runs on its own thread.
340 base::Thread plugin_thread_; 340 base::Thread plugin_thread_;
341 // The message loop for the main (host) thread. 341 // The message loop for the main (host) thread.
342 MessageLoop message_loop_; 342 base::MessageLoop message_loop_;
343 343
344 // Aliases for the host and plugin harnesses; if we're testing a PPP 344 // Aliases for the host and plugin harnesses; if we're testing a PPP
345 // interface, remote_harness will point to plugin_, and local_harness 345 // interface, remote_harness will point to plugin_, and local_harness
346 // will point to host_. This makes it convenient when we're starting and 346 // will point to host_. This makes it convenient when we're starting and
347 // stopping the harnesses. 347 // stopping the harnesses.
348 ProxyTestHarnessBase* remote_harness_; 348 ProxyTestHarnessBase* remote_harness_;
349 ProxyTestHarnessBase* local_harness_; 349 ProxyTestHarnessBase* local_harness_;
350 350
351 base::WaitableEvent channel_created_; 351 base::WaitableEvent channel_created_;
352 base::WaitableEvent shutdown_event_; 352 base::WaitableEvent shutdown_event_;
353 }; 353 };
354 354
355 // Used during Gtests when you have a PP_Var that you want to EXPECT is equal 355 // Used during Gtests when you have a PP_Var that you want to EXPECT is equal
356 // to a certain constant string value: 356 // to a certain constant string value:
357 // 357 //
358 // EXPECT_VAR_IS_STRING("foo", my_var); 358 // EXPECT_VAR_IS_STRING("foo", my_var);
359 #define EXPECT_VAR_IS_STRING(str, var) { \ 359 #define EXPECT_VAR_IS_STRING(str, var) { \
360 StringVar* sv = StringVar::FromPPVar(var); \ 360 StringVar* sv = StringVar::FromPPVar(var); \
361 EXPECT_TRUE(sv); \ 361 EXPECT_TRUE(sv); \
362 if (sv) \ 362 if (sv) \
363 EXPECT_EQ(str, sv->value()); \ 363 EXPECT_EQ(str, sv->value()); \
364 } 364 }
365 365
366 } // namespace proxy 366 } // namespace proxy
367 } // namespace ppapi 367 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/plugin_main_nacl.cc ('k') | ppapi/proxy/ppapi_proxy_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698