OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gin/test/file_runner.h" | 5 #include "gin/test/file_runner.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/message_loop/message_loop.h" | |
9 #include "base/path_service.h" | 8 #include "base/path_service.h" |
10 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/test/scoped_task_environment.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "gin/array_buffer.h" | 12 #include "gin/array_buffer.h" |
13 #include "gin/converter.h" | 13 #include "gin/converter.h" |
14 #include "gin/modules/console.h" | 14 #include "gin/modules/console.h" |
15 #include "gin/modules/module_registry.h" | 15 #include "gin/modules/module_registry.h" |
16 #include "gin/public/context_holder.h" | 16 #include "gin/public/context_holder.h" |
17 #include "gin/public/isolate_holder.h" | 17 #include "gin/public/isolate_holder.h" |
18 #include "gin/test/file.h" | 18 #include "gin/test/file.h" |
19 #include "gin/test/gc.h" | 19 #include "gin/test/gc.h" |
20 #include "gin/test/gtest.h" | 20 #include "gin/test/gtest.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 ModuleRunnerDelegate::UnhandledException(runner, try_catch); | 52 ModuleRunnerDelegate::UnhandledException(runner, try_catch); |
53 FAIL() << try_catch.GetStackTrace(); | 53 FAIL() << try_catch.GetStackTrace(); |
54 } | 54 } |
55 | 55 |
56 void RunTestFromFile(const base::FilePath& path, FileRunnerDelegate* delegate, | 56 void RunTestFromFile(const base::FilePath& path, FileRunnerDelegate* delegate, |
57 bool run_until_idle) { | 57 bool run_until_idle) { |
58 ASSERT_TRUE(base::PathExists(path)) << path.LossyDisplayName(); | 58 ASSERT_TRUE(base::PathExists(path)) << path.LossyDisplayName(); |
59 std::string source; | 59 std::string source; |
60 ASSERT_TRUE(ReadFileToString(path, &source)); | 60 ASSERT_TRUE(ReadFileToString(path, &source)); |
61 | 61 |
62 base::MessageLoop message_loop; | 62 base::test::ScopedTaskEnvironment scoped_task_environment; |
63 | 63 |
64 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 64 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
65 gin::V8Initializer::LoadV8Snapshot(); | 65 gin::V8Initializer::LoadV8Snapshot(); |
66 gin::V8Initializer::LoadV8Natives(); | 66 gin::V8Initializer::LoadV8Natives(); |
67 #endif | 67 #endif |
68 | 68 |
69 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, | 69 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
70 gin::IsolateHolder::kStableV8Extras, | 70 gin::IsolateHolder::kStableV8Extras, |
71 gin::ArrayBufferAllocator::SharedInstance()); | 71 gin::ArrayBufferAllocator::SharedInstance()); |
72 | 72 |
(...skipping 10 matching lines...) Expand all Loading... |
83 base::RunLoop().Run(); | 83 base::RunLoop().Run(); |
84 } | 84 } |
85 | 85 |
86 v8::Local<v8::Value> result = runner.global()->Get( | 86 v8::Local<v8::Value> result = runner.global()->Get( |
87 StringToSymbol(runner.GetContextHolder()->isolate(), "result")); | 87 StringToSymbol(runner.GetContextHolder()->isolate(), "result")); |
88 EXPECT_EQ("PASS", V8ToString(result)); | 88 EXPECT_EQ("PASS", V8ToString(result)); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 } // namespace gin | 92 } // namespace gin |
OLD | NEW |