| 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 "gin/array_buffer.h" | 18 #include "gin/array_buffer.h" |
| 19 #include "gin/public/isolate_holder.h" | 19 #include "gin/public/isolate_holder.h" |
| 20 #include "gin/v8_initializer.h" | 20 #include "gin/v8_initializer.h" |
| 21 #include "mojo/common/data_pipe_utils.h" | 21 #include "mojo/common/data_pipe_utils.h" |
| 22 #include "mojo/edk/js/mojo_runner_delegate.h" | 22 #include "mojo/edk/js/mojo_runner_delegate.h" |
| 23 #include "mojo/edk/js/tests/js_to_cpp.mojom.h" | 23 #include "mojo/edk/js/tests/js_to_cpp.mojom.h" |
| 24 #include "mojo/edk/test/test_utils.h" | 24 #include "mojo/edk/test/test_utils.h" |
| 25 #include "mojo/public/cpp/bindings/binding.h" | 25 #include "mojo/public/cpp/bindings/binding.h" |
| 26 #include "mojo/public/cpp/bindings/lib/validation_errors.h" |
| 26 #include "mojo/public/cpp/system/core.h" | 27 #include "mojo/public/cpp/system/core.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
| 28 | 29 |
| 29 namespace mojo { | 30 namespace mojo { |
| 30 namespace edk { | 31 namespace edk { |
| 31 namespace js { | 32 namespace js { |
| 32 | 33 |
| 33 // Global value updated by some checks to prevent compilers from optimizing | 34 // Global value updated by some checks to prevent compilers from optimizing |
| 34 // reads out of existence. | 35 // reads out of existence. |
| 35 uint32_t g_waste_accumulator = 0; | 36 uint32_t g_waste_accumulator = 0; |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 427 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
| 427 } | 428 } |
| 428 | 429 |
| 429 TEST_F(JsToCppTest, Echo) { | 430 TEST_F(JsToCppTest, Echo) { |
| 430 EchoCppSideConnection cpp_side_connection; | 431 EchoCppSideConnection cpp_side_connection; |
| 431 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); |
| 432 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 433 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
| 433 } | 434 } |
| 434 | 435 |
| 435 TEST_F(JsToCppTest, BitFlip) { | 436 TEST_F(JsToCppTest, BitFlip) { |
| 437 // These tests generate a lot of expected validation errors. Suppress logging. |
| 438 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression; |
| 439 |
| 436 BitFlipCppSideConnection cpp_side_connection; | 440 BitFlipCppSideConnection cpp_side_connection; |
| 437 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); | 441 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); |
| 438 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 442 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
| 439 } | 443 } |
| 440 | 444 |
| 441 TEST_F(JsToCppTest, BackPointer) { | 445 TEST_F(JsToCppTest, BackPointer) { |
| 446 // These tests generate a lot of expected validation errors. Suppress logging. |
| 447 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression; |
| 448 |
| 442 BackPointerCppSideConnection cpp_side_connection; | 449 BackPointerCppSideConnection cpp_side_connection; |
| 443 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); |
| 444 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 451 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
| 445 } | 452 } |
| 446 | 453 |
| 447 } // namespace js | 454 } // namespace js |
| 448 } // namespace edk | 455 } // namespace edk |
| 449 } // namespace mojo | 456 } // namespace mojo |
| OLD | NEW |