Index: content/test/blink_test_environment.cc |
diff --git a/content/test/blink_test_environment.cc b/content/test/blink_test_environment.cc |
index 510662545c2960e90a935da13a11dfecc7fc1e28..67c7a1bb4ea3cce545a08aea20308b2fde95d84c 100644 |
--- a/content/test/blink_test_environment.cc |
+++ b/content/test/blink_test_environment.cc |
@@ -10,6 +10,7 @@ |
#include "base/message_loop/message_loop.h" |
#include "base/run_loop.h" |
#include "base/strings/string_tokenizer.h" |
+#include "base/test/scoped_async_task_scheduler.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 +37,9 @@ 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; |
-#endif |
- |
TestEnvironment() { |
- main_message_loop_.reset(new MessageLoopType); |
- |
- // TestBlinkWebUnitTestSupport must be instantiated after MessageLoopType. |
+ // TestBlinkWebUnitTestSupport must be instantiated after the main |
+ // MessageLoop. |
blink_test_support_.reset(new TestBlinkWebUnitTestSupport); |
content_initializer_.reset(new content::TestContentClientInitializer()); |
@@ -62,7 +55,17 @@ class TestEnvironment { |
} |
private: |
- std::unique_ptr<MessageLoopType> main_message_loop_; |
+#if defined(OS_ANDROID) |
+ // Android UI message loop goes through Java, so don't use it in tests. |
+ base::MessageLoop main_message_loop_; |
+#else |
+ base::MessageLoopForUI main_message_loop_; |
+#endif |
+ |
+ // Required by gin::V8Platform::CallOnBackgroundThread(). Can't be a |
+ // ScopedTaskScheduler because v8 synchronously waits for tasks to run. |
+ base::test::ScopedAsyncTaskScheduler scoped_async_task_scheduler; |
+ |
std::unique_ptr<TestBlinkWebUnitTestSupport> blink_test_support_; |
std::unique_ptr<TestContentClientInitializer> content_initializer_; |
base::TestDiscardableMemoryAllocator discardable_memory_allocator_; |