| 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/test/scoped_async_task_scheduler.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "gin/array_buffer.h" | 20 #include "gin/array_buffer.h" |
| 20 #include "gin/public/isolate_holder.h" | 21 #include "gin/public/isolate_holder.h" |
| 21 #include "gin/v8_initializer.h" | 22 #include "gin/v8_initializer.h" |
| 22 #include "mojo/common/data_pipe_utils.h" | 23 #include "mojo/common/data_pipe_utils.h" |
| 23 #include "mojo/edk/js/mojo_runner_delegate.h" | 24 #include "mojo/edk/js/mojo_runner_delegate.h" |
| 24 #include "mojo/edk/js/tests/js_to_cpp.mojom.h" | 25 #include "mojo/edk/js/tests/js_to_cpp.mojom.h" |
| 25 #include "mojo/edk/test/test_utils.h" | 26 #include "mojo/edk/test/test_utils.h" |
| 26 #include "mojo/public/cpp/bindings/binding.h" | 27 #include "mojo/public/cpp/bindings/binding.h" |
| 27 #include "mojo/public/cpp/bindings/lib/validation_errors.h" | 28 #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 test); | 413 test); |
| 413 | 414 |
| 414 run_loop_.Run(); | 415 run_loop_.Run(); |
| 415 } | 416 } |
| 416 | 417 |
| 417 private: | 418 private: |
| 418 base::ShadowingAtExitManager at_exit_; | 419 base::ShadowingAtExitManager at_exit_; |
| 419 base::MessageLoop loop; | 420 base::MessageLoop loop; |
| 420 base::RunLoop run_loop_; | 421 base::RunLoop run_loop_; |
| 421 | 422 |
| 423 // Required by gin::V8Platform::CallOnBackgroundThread(). Can't be a |
| 424 // ScopedTaskScheduler because v8 synchronously waits for tasks to run. |
| 425 base::test::ScopedAsyncTaskScheduler scoped_async_task_scheduler; |
| 426 |
| 422 DISALLOW_COPY_AND_ASSIGN(JsToCppTest); | 427 DISALLOW_COPY_AND_ASSIGN(JsToCppTest); |
| 423 }; | 428 }; |
| 424 | 429 |
| 425 TEST_F(JsToCppTest, Ping) { | 430 TEST_F(JsToCppTest, Ping) { |
| 426 PingCppSideConnection cpp_side_connection; | 431 PingCppSideConnection cpp_side_connection; |
| 427 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); | 432 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); |
| 428 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 433 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
| 429 } | 434 } |
| 430 | 435 |
| 431 TEST_F(JsToCppTest, Echo) { | 436 TEST_F(JsToCppTest, Echo) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 448 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression; | 453 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression; |
| 449 | 454 |
| 450 BackPointerCppSideConnection cpp_side_connection; | 455 BackPointerCppSideConnection cpp_side_connection; |
| 451 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); | 456 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); |
| 452 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 457 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
| 453 } | 458 } |
| 454 | 459 |
| 455 } // namespace js | 460 } // namespace js |
| 456 } // namespace edk | 461 } // namespace edk |
| 457 } // namespace mojo | 462 } // namespace mojo |
| OLD | NEW |