Chromium Code Reviews| Index: content/test/blink_test_environment.cc |
| diff --git a/content/test/blink_test_environment.cc b/content/test/blink_test_environment.cc |
| index 2b9a55c35ab30766e0069268225d88e961c189ea..4dfab3eab9e013f3626ff84314b10ebbb86fc09e 100644 |
| --- a/content/test/blink_test_environment.cc |
| +++ b/content/test/blink_test_environment.cc |
| @@ -7,9 +7,9 @@ |
| #include <string> |
| #include "base/command_line.h" |
| -#include "base/message_loop/message_loop.h" |
| #include "base/run_loop.h" |
| #include "base/strings/string_tokenizer.h" |
| +#include "base/test/scoped_task_environment.h" |
| #include "base/test/test_discardable_memory_allocator.h" |
| #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| #include "build/build_config.h" |
| @@ -36,17 +36,16 @@ namespace { |
| class TestEnvironment { |
| public: |
| -#if defined(OS_ANDROID) |
| - // Android UI message loop goes through Java, so don't use it in tests. |
| - typedef base::MessageLoop MessageLoopType; |
| -#else |
| - typedef base::MessageLoopForUI MessageLoopType; |
| + TestEnvironment() |
| +#if !defined(OS_ANDROID) |
| + // On Android, do not pump UI messages on the main thread because that |
| + // would go through Java. |
|
gab
2017/05/03 17:38:36
// On Android, Java pumps UI messages.
fdoray
2017/05/03 20:48:44
Done.
|
| + : scoped_task_environment_( |
| + base::test::ScopedTaskEnvironment::MainThreadType::UI) |
| #endif |
| - |
| - TestEnvironment() { |
| - main_message_loop_.reset(new MessageLoopType); |
| - |
| - // TestBlinkWebUnitTestSupport must be instantiated after MessageLoopType. |
| + { |
| + // TestBlinkWebUnitTestSupport must be instantiated after |
| + // ScopedTaskEnvironment. |
|
gab
2017/05/03 17:38:36
Move this comment to the member and make both of t
fdoray
2017/05/03 20:48:44
Done.
|
| blink_test_support_.reset(new TestBlinkWebUnitTestSupport); |
| content_initializer_.reset(new content::TestContentClientInitializer()); |
| @@ -62,7 +61,8 @@ class TestEnvironment { |
| } |
| private: |
| - std::unique_ptr<MessageLoopType> main_message_loop_; |
| + base::test::ScopedTaskEnvironment scoped_task_environment_; |
| + |
| std::unique_ptr<TestBlinkWebUnitTestSupport> blink_test_support_; |
| std::unique_ptr<TestContentClientInitializer> content_initializer_; |
| base::TestDiscardableMemoryAllocator discardable_memory_allocator_; |