| 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" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "gin/array_buffer.h" | 10 #include "gin/array_buffer.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 ASSERT_TRUE(ReadFileToString(path, &source)); | 58 ASSERT_TRUE(ReadFileToString(path, &source)); |
| 59 | 59 |
| 60 base::MessageLoop message_loop; | 60 base::MessageLoop message_loop; |
| 61 | 61 |
| 62 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 62 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 63 gin::V8Initializer::LoadV8Snapshot(); | 63 gin::V8Initializer::LoadV8Snapshot(); |
| 64 gin::V8Initializer::LoadV8Natives(); | 64 gin::V8Initializer::LoadV8Natives(); |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, | 67 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
| 68 gin::IsolateHolder::kStableV8Extras, |
| 68 gin::ArrayBufferAllocator::SharedInstance()); | 69 gin::ArrayBufferAllocator::SharedInstance()); |
| 69 | 70 |
| 70 gin::IsolateHolder instance; | 71 gin::IsolateHolder instance; |
| 71 gin::ShellRunner runner(delegate, instance.isolate()); | 72 gin::ShellRunner runner(delegate, instance.isolate()); |
| 72 { | 73 { |
| 73 gin::Runner::Scope scope(&runner); | 74 gin::Runner::Scope scope(&runner); |
| 74 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); | 75 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); |
| 75 runner.Run(source, path.AsUTF8Unsafe()); | 76 runner.Run(source, path.AsUTF8Unsafe()); |
| 76 | 77 |
| 77 if (run_until_idle) { | 78 if (run_until_idle) { |
| 78 message_loop.RunUntilIdle(); | 79 message_loop.RunUntilIdle(); |
| 79 } else { | 80 } else { |
| 80 message_loop.Run(); | 81 message_loop.Run(); |
| 81 } | 82 } |
| 82 | 83 |
| 83 v8::Local<v8::Value> result = runner.global()->Get( | 84 v8::Local<v8::Value> result = runner.global()->Get( |
| 84 StringToSymbol(runner.GetContextHolder()->isolate(), "result")); | 85 StringToSymbol(runner.GetContextHolder()->isolate(), "result")); |
| 85 EXPECT_EQ("PASS", V8ToString(result)); | 86 EXPECT_EQ("PASS", V8ToString(result)); |
| 86 } | 87 } |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace gin | 90 } // namespace gin |
| OLD | NEW |