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

Use ScopedTaskEnvironment instead of MessageLoop in /ui/ozone/platform/drm

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

Change-Id: I92a1b8c3530059938c9300774d0a9f3e007b49c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1649324
Auto-Submit: Carlos Caballero <carlscab@google.com>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Commit-Queue: Daniele Castagna <dcastagna@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667161}
parent 77c581a1
......@@ -8,8 +8,8 @@
#include <utility>
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/thread.h"
#include "base/threading/thread_checker_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -32,7 +32,7 @@ class ProxyHelpersTest : public testing::Test {
void QuitFunction(int a) {
EXPECT_TRUE(drm_checker_.CalledOnValidThread());
message_loop_.task_runner()->PostTask(
scoped_task_environment_.GetMainThreadTaskRunner()->PostTask(
FROM_HERE, base::BindOnce(&ProxyHelpersTest::QuitFunctionCallback,
base::Unretained(this), 8));
}
......@@ -42,7 +42,8 @@ class ProxyHelpersTest : public testing::Test {
EXPECT_TRUE(main_checker_.CalledOnValidThread());
auto quitter = run_loop_.QuitWhenIdleClosure();
message_loop_.task_runner()->PostTask(FROM_HERE, quitter);
scoped_task_environment_.GetMainThreadTaskRunner()->PostTask(FROM_HERE,
quitter);
}
void SetDrmChecker() { drm_checker_.DetachFromThread(); }
......@@ -90,7 +91,7 @@ class ProxyHelpersTest : public testing::Test {
protected:
// Main thread message loop.
base::MessageLoop message_loop_;
base::test::ScopedTaskEnvironment scoped_task_environment_;
base::RunLoop run_loop_;
// Thread to simulate the drm thread in ozone viz process.
......
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