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" | |
6 #include "base/file_util.h" | 5 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
8 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
11 #include "gin/public/isolate_holder.h" | 10 #include "gin/public/isolate_holder.h" |
12 #include "mojo/apps/js/mojo_runner_delegate.h" | 11 #include "mojo/apps/js/mojo_runner_delegate.h" |
13 #include "mojo/apps/js/test/js_to_cpp.mojom.h" | 12 #include "mojo/apps/js/test/js_to_cpp.mojom.h" |
14 #include "mojo/common/common_type_converters.h" | 13 #include "mojo/common/common_type_converters.h" |
15 #include "mojo/common/test/test_utils.h" | 14 #include "mojo/common/test/test_utils.h" |
16 #include "mojo/public/cpp/bindings/allocation_scope.h" | 15 #include "mojo/public/cpp/bindings/allocation_scope.h" |
| 16 #include "mojo/public/cpp/environment/environment.h" |
17 #include "mojo/public/cpp/system/core.h" | 17 #include "mojo/public/cpp/system/core.h" |
18 #include "mojo/public/cpp/system/macros.h" | 18 #include "mojo/public/cpp/system/macros.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 namespace mojo { | 21 namespace mojo { |
22 namespace js { | 22 namespace js { |
23 | 23 |
24 // Global value updated by some checks to prevent compilers from optimizing | 24 // Global value updated by some checks to prevent compilers from optimizing |
25 // reads out of existence. | 25 // reads out of existence. |
26 uint32 g_waste_accumulator = 0; | 26 uint32 g_waste_accumulator = 0; |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 407 |
408 gin::IsolateHolder instance(gin::IsolateHolder::kStrictMode); | 408 gin::IsolateHolder instance(gin::IsolateHolder::kStrictMode); |
409 apps::MojoRunnerDelegate delegate; | 409 apps::MojoRunnerDelegate delegate; |
410 gin::ShellRunner runner(&delegate, instance.isolate()); | 410 gin::ShellRunner runner(&delegate, instance.isolate()); |
411 delegate.Start(&runner, pipe.handle1.release().value(), test); | 411 delegate.Start(&runner, pipe.handle1.release().value(), test); |
412 | 412 |
413 run_loop_.Run(); | 413 run_loop_.Run(); |
414 } | 414 } |
415 | 415 |
416 private: | 416 private: |
417 base::ShadowingAtExitManager at_exit_; | 417 Environment environment; |
418 base::MessageLoop loop; | 418 base::MessageLoop loop; |
419 base::RunLoop run_loop_; | 419 base::RunLoop run_loop_; |
420 | 420 |
421 DISALLOW_COPY_AND_ASSIGN(JsToCppTest); | 421 DISALLOW_COPY_AND_ASSIGN(JsToCppTest); |
422 }; | 422 }; |
423 | 423 |
424 TEST_F(JsToCppTest, Ping) { | 424 TEST_F(JsToCppTest, Ping) { |
425 if (IsRunningOnIsolatedBot()) | 425 if (IsRunningOnIsolatedBot()) |
426 return; | 426 return; |
427 | 427 |
(...skipping 26 matching lines...) Expand all Loading... |
454 if (IsRunningOnIsolatedBot()) | 454 if (IsRunningOnIsolatedBot()) |
455 return; | 455 return; |
456 | 456 |
457 BackPointerCppSideConnection cpp_side_connection; | 457 BackPointerCppSideConnection cpp_side_connection; |
458 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection); | 458 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection); |
459 EXPECT_TRUE(cpp_side_connection.DidSucceed()); | 459 EXPECT_TRUE(cpp_side_connection.DidSucceed()); |
460 } | 460 } |
461 | 461 |
462 } // namespace js | 462 } // namespace js |
463 } // namespace mojo | 463 } // namespace mojo |
OLD | NEW |