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