Commit c24a6539 authored by Carlos Caballero's avatar Carlos Caballero Committed by Commit Bot

Use ScopedTaskEnvironment instead of MessageLoop in /device/gamepad

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=mattreynolds@chromium.org

Change-Id: I36fdabd895249be6a9c2c00952b90a2ba3b0855e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1648203
Auto-Submit: Carlos Caballero <carlscab@google.com>
Reviewed-by: default avatarMatt Reynolds <mattreynolds@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667272}
parent 7e0507a6
...@@ -164,6 +164,7 @@ static_library("test_helpers") { ...@@ -164,6 +164,7 @@ static_library("test_helpers") {
public_deps = [ public_deps = [
":gamepad", ":gamepad",
"//base", "//base",
"//base/test:test_support",
"//device/gamepad/public/cpp:shared_with_blink", "//device/gamepad/public/cpp:shared_with_blink",
"//third_party/blink/public:blink_headers", "//third_party/blink/public:blink_headers",
] ]
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#include <memory> #include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/test/scoped_task_environment.h"
#include "device/gamepad/gamepad_data_fetcher.h" #include "device/gamepad/gamepad_data_fetcher.h"
#include "device/gamepad/gamepad_service.h" #include "device/gamepad/gamepad_service.h"
#include "device/gamepad/gamepad_shared_buffer.h" #include "device/gamepad/gamepad_shared_buffer.h"
...@@ -58,11 +58,9 @@ class GamepadTestHelper { ...@@ -58,11 +58,9 @@ class GamepadTestHelper {
GamepadTestHelper(); GamepadTestHelper();
virtual ~GamepadTestHelper(); virtual ~GamepadTestHelper();
base::MessageLoop& message_loop() { return message_loop_; }
private: private:
// This must be constructed before the system monitor. // This must be constructed before the system monitor.
base::MessageLoop message_loop_; base::test::ScopedTaskEnvironment scoped_task_environment_;
DISALLOW_COPY_AND_ASSIGN(GamepadTestHelper); DISALLOW_COPY_AND_ASSIGN(GamepadTestHelper);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment