Skip to content

Commit

Permalink
Use ScopedTaskEnvironment instead of MessageLoop in /ppapi/proxy
Browse files Browse the repository at this point in the history
MessageLoop will go away, eventually.

ScopedTaskEnvironment will per default start a ThreadPool, which should
be fine in most of the cases. If you belive your test needs to make sure
that no ThreadPool runs let me know and I will update the patch.

BUG=891670
This CL was uploaded by git cl split.

R=piman@chromium.org

Change-Id: Ida93c455e32bf058063b6bf48800b289c972823b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1649326
Auto-Submit: Carlos Caballero <carlscab@google.com>
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667191}
  • Loading branch information
carlscabgro authored and Commit Bot committed Jun 7, 2019
1 parent 26598d4 commit 87cbd6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions ppapi/proxy/ppapi_proxy_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/task_runner.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/simple_thread.h"
#include "base/threading/thread.h"
#include "ppapi/c/pp_instance.h"
Expand Down Expand Up @@ -202,7 +202,7 @@ class PluginProxyTest : public PluginProxyTestHarness, public testing::Test {
virtual void SetUp();
virtual void TearDown();
private:
base::MessageLoop message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_;
};

// This class provides support for multi-thread testing. A secondary thread is
Expand Down Expand Up @@ -334,7 +334,7 @@ class HostProxyTest : public HostProxyTestHarness, public testing::Test {
virtual void SetUp();
virtual void TearDown();
private:
base::MessageLoop message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_;
};

// Use this base class to test both sides of a proxy.
Expand Down Expand Up @@ -372,7 +372,7 @@ class TwoWayTest : public testing::Test {
// The plugin side of the proxy runs on its own thread.
base::Thread plugin_thread_;
// The message loop for the main (host) thread.
base::MessageLoop message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_;

// Aliases for the host and plugin harnesses; if we're testing a PPP
// interface, remote_harness will point to plugin_, and local_harness
Expand Down
5 changes: 3 additions & 2 deletions ppapi/proxy/raw_var_data_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/test/scoped_task_environment.h"
#include "base/values.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_var.h"
Expand Down Expand Up @@ -52,7 +52,8 @@ class RawVarDataTest : public testing::Test {
}

private:
base::MessageLoop message_loop_; // Required to receive callbacks.
base::test::ScopedTaskEnvironment
scoped_task_environment_; // Required to receive callbacks.
TestGlobals globals_;
};

Expand Down

0 comments on commit 87cbd6e

Please sign in to comment.