Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: mojo/edk/js/tests/js_to_cpp_tests.cc

Issue 2852373004: Use ScopedTaskEnvironment instead of MessageLoop in tests that use v8. (Closed)
Patch Set: Reset-RenderViewTest Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/js/tests/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
16 #include "base/run_loop.h" 15 #include "base/run_loop.h"
17 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/test/scoped_task_environment.h"
18 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
19 #include "gin/array_buffer.h" 19 #include "gin/array_buffer.h"
20 #include "gin/public/isolate_holder.h" 20 #include "gin/public/isolate_holder.h"
21 #include "gin/v8_initializer.h" 21 #include "gin/v8_initializer.h"
22 #include "mojo/common/data_pipe_utils.h" 22 #include "mojo/common/data_pipe_utils.h"
23 #include "mojo/edk/js/mojo_runner_delegate.h" 23 #include "mojo/edk/js/mojo_runner_delegate.h"
24 #include "mojo/edk/js/tests/js_to_cpp.mojom.h" 24 #include "mojo/edk/js/tests/js_to_cpp.mojom.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/bindings/lib/validation_errors.h"
27 #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
411 MojoRunnerDelegate delegate; 411 MojoRunnerDelegate delegate;
412 gin::ShellRunner runner(&delegate, instance.isolate()); 412 gin::ShellRunner runner(&delegate, instance.isolate());
413 delegate.Start(&runner, js_side_proxy.PassMessagePipe().release().value(), 413 delegate.Start(&runner, js_side_proxy.PassMessagePipe().release().value(),
414 test); 414 test);
415 415
416 run_loop_.Run(); 416 run_loop_.Run();
417 } 417 }
418 418
419 private: 419 private:
420 base::ShadowingAtExitManager at_exit_; 420 base::ShadowingAtExitManager at_exit_;
421 base::MessageLoop loop; 421 base::test::ScopedTaskEnvironment scoped_task_environment_;
422 base::RunLoop run_loop_; 422 base::RunLoop run_loop_;
423 423
424 DISALLOW_COPY_AND_ASSIGN(JsToCppTest); 424 DISALLOW_COPY_AND_ASSIGN(JsToCppTest);
425 }; 425 };
426 426
427 TEST_F(JsToCppTest, Ping) { 427 TEST_F(JsToCppTest, Ping) {
428 PingCppSideConnection cpp_side_connection; 428 PingCppSideConnection cpp_side_connection;
429 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); 429 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection);
430 EXPECT_TRUE(cpp_side_connection.DidSucceed()); 430 EXPECT_TRUE(cpp_side_connection.DidSucceed());
431 } 431 }
(...skipping 18 matching lines...) Expand all
450 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression; 450 mojo::internal::ScopedSuppressValidationErrorLoggingForTests log_suppression;
451 451
452 BackPointerCppSideConnection cpp_side_connection; 452 BackPointerCppSideConnection cpp_side_connection;
453 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection); 453 RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection);
454 EXPECT_TRUE(cpp_side_connection.DidSucceed()); 454 EXPECT_TRUE(cpp_side_connection.DidSucceed());
455 } 455 }
456 456
457 } // namespace js 457 } // namespace js
458 } // namespace edk 458 } // namespace edk
459 } // namespace mojo 459 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/js/tests/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698