OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" |
18 #include "gin/array_buffer.h" | 19 #include "gin/array_buffer.h" |
19 #include "gin/public/isolate_holder.h" | 20 #include "gin/public/isolate_holder.h" |
20 #include "gin/v8_initializer.h" | 21 #include "gin/v8_initializer.h" |
21 #include "mojo/common/data_pipe_utils.h" | 22 #include "mojo/common/data_pipe_utils.h" |
22 #include "mojo/edk/js/mojo_runner_delegate.h" | 23 #include "mojo/edk/js/mojo_runner_delegate.h" |
23 #include "mojo/edk/js/tests/js_to_cpp.mojom.h" | 24 #include "mojo/edk/js/tests/js_to_cpp.mojom.h" |
24 #include "mojo/edk/test/test_utils.h" | 25 #include "mojo/edk/test/test_utils.h" |
25 #include "mojo/public/cpp/bindings/binding.h" | 26 #include "mojo/public/cpp/bindings/binding.h" |
26 #include "mojo/public/cpp/bindings/lib/validation_errors.h" | 27 #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
27 #include "mojo/public/cpp/system/core.h" | 28 #include "mojo/public/cpp/system/core.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 js_side->SetCppSide(std::move(cpp_side_ptr)); | 398 js_side->SetCppSide(std::move(cpp_side_ptr)); |
398 | 399 |
399 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 400 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
400 gin::V8Initializer::LoadV8Snapshot(); | 401 gin::V8Initializer::LoadV8Snapshot(); |
401 gin::V8Initializer::LoadV8Natives(); | 402 gin::V8Initializer::LoadV8Natives(); |
402 #endif | 403 #endif |
403 | 404 |
404 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, | 405 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
405 gin::IsolateHolder::kStableV8Extras, | 406 gin::IsolateHolder::kStableV8Extras, |
406 gin::ArrayBufferAllocator::SharedInstance()); | 407 gin::ArrayBufferAllocator::SharedInstance()); |
407 gin::IsolateHolder instance; | 408 gin::IsolateHolder instance(base::ThreadTaskRunnerHandle::Get()); |
408 MojoRunnerDelegate delegate; | 409 MojoRunnerDelegate delegate; |
409 gin::ShellRunner runner(&delegate, instance.isolate()); | 410 gin::ShellRunner runner(&delegate, instance.isolate()); |
410 delegate.Start(&runner, js_side_proxy.PassMessagePipe().release().value(), | 411 delegate.Start(&runner, js_side_proxy.PassMessagePipe().release().value(), |
411 test); | 412 test); |
412 | 413 |
413 run_loop_.Run(); | 414 run_loop_.Run(); |
414 } | 415 } |
415 | 416 |
416 private: | 417 private: |
417 base::ShadowingAtExitManager at_exit_; | 418 base::ShadowingAtExitManager at_exit_; |
(...skipping 29 matching lines...) Expand all Loading... |
447 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression; | 448 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression; |
448 | 449 |
449 BackPointerCppSideConnection cpp_side_connection; | 450 BackPointerCppSideConnection cpp_side_connection; |
450 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); | 451 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); |
451 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 452 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
452 } | 453 } |
453 | 454 |
454 } // namespace js | 455 } // namespace js |
455 } // namespace edk | 456 } // namespace edk |
456 } // namespace mojo | 457 } // namespace mojo |
OLD | NEW |