| 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/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/rand_util.h" |
| 12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 15 #include "crypto/random.h" | |
| 16 #include "mojo/dart/embedder/dart_controller.h" | 16 #include "mojo/dart/embedder/dart_controller.h" |
| 17 #include "mojo/dart/embedder/test/dart_to_cpp.mojom.h" | 17 #include "mojo/dart/embedder/test/dart_to_cpp.mojom.h" |
| 18 #include "mojo/edk/test/test_utils.h" | 18 #include "mojo/edk/test/test_utils.h" |
| 19 #include "mojo/public/cpp/bindings/strong_binding.h" | 19 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 20 #include "mojo/public/cpp/system/core.h" | 20 #include "mojo/public/cpp/system/core.h" |
| 21 #include "mojo/public/cpp/system/macros.h" | 21 #include "mojo/public/cpp/system/macros.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 namespace mojo { | 24 namespace mojo { |
| 25 namespace dart { | 25 namespace dart { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 private: | 271 private: |
| 272 base::MessageLoop loop; | 272 base::MessageLoop loop; |
| 273 base::RunLoop run_loop_; | 273 base::RunLoop run_loop_; |
| 274 | 274 |
| 275 static void UnhandledExceptionCallback(bool* exception, Dart_Handle error) { | 275 static void UnhandledExceptionCallback(bool* exception, Dart_Handle error) { |
| 276 *exception = true; | 276 *exception = true; |
| 277 } | 277 } |
| 278 | 278 |
| 279 static bool GenerateEntropy(uint8_t* buffer, intptr_t length) { | 279 static bool GenerateEntropy(uint8_t* buffer, intptr_t length) { |
| 280 crypto::RandBytes(reinterpret_cast<void*>(buffer), length); | 280 base::RandBytes(reinterpret_cast<void*>(buffer), length); |
| 281 return true; | 281 return true; |
| 282 } | 282 } |
| 283 | 283 |
| 284 static void InitializeDartConfig(DartControllerConfig* config, | 284 static void InitializeDartConfig(DartControllerConfig* config, |
| 285 const std::string& test, | 285 const std::string& test, |
| 286 MojoHandle handle, | 286 MojoHandle handle, |
| 287 const char** arguments, | 287 const char** arguments, |
| 288 int arguments_count, | 288 int arguments_count, |
| 289 bool* unhandled_exception, | 289 bool* unhandled_exception, |
| 290 char** error) { | 290 char** error) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 TEST_F(DartToCppTest, Echo) { | 375 TEST_F(DartToCppTest, Echo) { |
| 376 EchoCppSideConnection cpp_side_connection; | 376 EchoCppSideConnection cpp_side_connection; |
| 377 bool unhandled_exception = | 377 bool unhandled_exception = |
| 378 RunTest("dart_to_cpp_tests.dart", &cpp_side_connection); | 378 RunTest("dart_to_cpp_tests.dart", &cpp_side_connection); |
| 379 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 379 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
| 380 EXPECT_FALSE(unhandled_exception); | 380 EXPECT_FALSE(unhandled_exception); |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace dart | 383 } // namespace dart |
| 384 } // namespace mojo | 384 } // namespace mojo |
| OLD | NEW |