| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "gin/array_buffer.h" | 12 #include "gin/array_buffer.h" |
| 13 #include "gin/public/isolate_holder.h" | 13 #include "gin/public/isolate_holder.h" |
| 14 #include "mojo/apps/js/mojo_runner_delegate.h" | 14 #include "mojo/apps/js/mojo_runner_delegate.h" |
| 15 #include "mojo/apps/js/test/js_to_cpp.mojom.h" | 15 #include "mojo/apps/js/test/js_to_cpp.mojom.h" |
| 16 #include "mojo/common/common_type_converters.h" | 16 #include "mojo/common/common_type_converters.h" |
| 17 #include "mojo/edk/test/test_utils.h" | 17 #include "mojo/edk/test/test_utils.h" |
| 18 #include "mojo/public/cpp/system/core.h" | 18 #include "mojo/public/cpp/system/core.h" |
| 19 #include "mojo/public/cpp/system/macros.h" | 19 #include "mojo/public/cpp/system/macros.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 23 #include "gin/public/isolate_holder.h" |
| 24 #endif |
| 25 |
| 22 namespace mojo { | 26 namespace mojo { |
| 23 namespace js { | 27 namespace js { |
| 24 | 28 |
| 25 // Global value updated by some checks to prevent compilers from optimizing | 29 // Global value updated by some checks to prevent compilers from optimizing |
| 26 // reads out of existence. | 30 // reads out of existence. |
| 27 uint32 g_waste_accumulator = 0; | 31 uint32 g_waste_accumulator = 0; |
| 28 | 32 |
| 29 namespace { | 33 namespace { |
| 30 | 34 |
| 31 // Negative numbers with different values in each byte, the last of | 35 // Negative numbers with different values in each byte, the last of |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 397 |
| 394 MessagePipe pipe; | 398 MessagePipe pipe; |
| 395 js_to_cpp::JsSidePtr js_side = | 399 js_to_cpp::JsSidePtr js_side = |
| 396 MakeProxy<js_to_cpp::JsSide>(pipe.handle0.Pass()); | 400 MakeProxy<js_to_cpp::JsSide>(pipe.handle0.Pass()); |
| 397 js_side.set_client(cpp_side); | 401 js_side.set_client(cpp_side); |
| 398 | 402 |
| 399 js_side.internal_state()->router_for_testing()->EnableTestingMode(); | 403 js_side.internal_state()->router_for_testing()->EnableTestingMode(); |
| 400 | 404 |
| 401 cpp_side->set_js_side(js_side.get()); | 405 cpp_side->set_js_side(js_side.get()); |
| 402 | 406 |
| 407 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 408 gin::IsolateHolder::LoadV8Snapshot(); |
| 409 #endif |
| 403 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, | 410 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
| 404 gin::ArrayBufferAllocator::SharedInstance()); | 411 gin::ArrayBufferAllocator::SharedInstance()); |
| 405 gin::IsolateHolder instance; | 412 gin::IsolateHolder instance; |
| 406 apps::MojoRunnerDelegate delegate; | 413 apps::MojoRunnerDelegate delegate; |
| 407 gin::ShellRunner runner(&delegate, instance.isolate()); | 414 gin::ShellRunner runner(&delegate, instance.isolate()); |
| 408 delegate.Start(&runner, pipe.handle1.release().value(), test); | 415 delegate.Start(&runner, pipe.handle1.release().value(), test); |
| 409 | 416 |
| 410 run_loop_.Run(); | 417 run_loop_.Run(); |
| 411 } | 418 } |
| 412 | 419 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 if (IsRunningOnIsolatedBot()) | 456 if (IsRunningOnIsolatedBot()) |
| 450 return; | 457 return; |
| 451 | 458 |
| 452 BackPointerCppSideConnection cpp_side_connection; | 459 BackPointerCppSideConnection cpp_side_connection; |
| 453 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection); | 460 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection); |
| 454 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 461 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
| 455 } | 462 } |
| 456 | 463 |
| 457 } // namespace js | 464 } // namespace js |
| 458 } // namespace mojo | 465 } // namespace mojo |
| OLD | NEW |