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/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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_; |
418 base::MessageLoop loop; | 419 base::MessageLoop loop; |
419 base::RunLoop run_loop_; | 420 base::RunLoop run_loop_; |
420 | 421 |
| 422 // Required by gin::V8Platform::CallOnBackgroundThread(). Can't be a |
| 423 // ScopedTaskScheduler because v8 synchronously waits for tasks to run. |
| 424 base::test::ScopedAsyncTaskScheduler scoped_async_task_scheduler; |
| 425 |
421 DISALLOW_COPY_AND_ASSIGN(JsToCppTest); | 426 DISALLOW_COPY_AND_ASSIGN(JsToCppTest); |
422 }; | 427 }; |
423 | 428 |
424 TEST_F(JsToCppTest, Ping) { | 429 TEST_F(JsToCppTest, Ping) { |
425 PingCppSideConnection cpp_side_connection; | 430 PingCppSideConnection cpp_side_connection; |
426 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); | 431 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); |
427 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 432 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
428 } | 433 } |
429 | 434 |
430 TEST_F(JsToCppTest, Echo) { | 435 TEST_F(JsToCppTest, Echo) { |
(...skipping 16 matching lines...) Expand all Loading... |
447 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression; | 452 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression; |
448 | 453 |
449 BackPointerCppSideConnection cpp_side_connection; | 454 BackPointerCppSideConnection cpp_side_connection; |
450 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); | 455 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); |
451 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 456 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
452 } | 457 } |
453 | 458 |
454 } // namespace js | 459 } // namespace js |
455 } // namespace edk | 460 } // namespace edk |
456 } // namespace mojo | 461 } // namespace mojo |
OLD | NEW |