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