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

Side by Side Diff: mojo/apps/js/test/js_to_cpp_unittest.cc

Issue 553903003: Refactor IsolateHolder to be able to always create the isolate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 3 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/apps/js/main.cc ('k') | net/DEPS » ('j') | 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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "gin/array_buffer.h"
11 #include "gin/public/isolate_holder.h" 12 #include "gin/public/isolate_holder.h"
12 #include "mojo/apps/js/mojo_runner_delegate.h" 13 #include "mojo/apps/js/mojo_runner_delegate.h"
13 #include "mojo/apps/js/test/js_to_cpp.mojom.h" 14 #include "mojo/apps/js/test/js_to_cpp.mojom.h"
14 #include "mojo/common/common_type_converters.h" 15 #include "mojo/common/common_type_converters.h"
15 #include "mojo/common/test/test_utils.h" 16 #include "mojo/common/test/test_utils.h"
16 #include "mojo/public/cpp/system/core.h" 17 #include "mojo/public/cpp/system/core.h"
17 #include "mojo/public/cpp/system/macros.h" 18 #include "mojo/public/cpp/system/macros.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 namespace mojo { 21 namespace mojo {
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 392
392 MessagePipe pipe; 393 MessagePipe pipe;
393 js_to_cpp::JsSidePtr js_side = 394 js_to_cpp::JsSidePtr js_side =
394 MakeProxy<js_to_cpp::JsSide>(pipe.handle0.Pass()); 395 MakeProxy<js_to_cpp::JsSide>(pipe.handle0.Pass());
395 js_side.set_client(cpp_side); 396 js_side.set_client(cpp_side);
396 397
397 js_side.internal_state()->router_for_testing()->EnableTestingMode(); 398 js_side.internal_state()->router_for_testing()->EnableTestingMode();
398 399
399 cpp_side->set_js_side(js_side.get()); 400 cpp_side->set_js_side(js_side.get());
400 401
401 gin::IsolateHolder instance(gin::IsolateHolder::kStrictMode); 402 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
403 gin::ArrayBufferAllocator::SharedInstance());
404 gin::IsolateHolder instance;
402 apps::MojoRunnerDelegate delegate; 405 apps::MojoRunnerDelegate delegate;
403 gin::ShellRunner runner(&delegate, instance.isolate()); 406 gin::ShellRunner runner(&delegate, instance.isolate());
404 delegate.Start(&runner, pipe.handle1.release().value(), test); 407 delegate.Start(&runner, pipe.handle1.release().value(), test);
405 408
406 run_loop_.Run(); 409 run_loop_.Run();
407 } 410 }
408 411
409 private: 412 private:
410 base::ShadowingAtExitManager at_exit_; 413 base::ShadowingAtExitManager at_exit_;
411 base::MessageLoop loop; 414 base::MessageLoop loop;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 if (IsRunningOnIsolatedBot()) 448 if (IsRunningOnIsolatedBot())
446 return; 449 return;
447 450
448 BackPointerCppSideConnection cpp_side_connection; 451 BackPointerCppSideConnection cpp_side_connection;
449 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection); 452 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection);
450 EXPECT_TRUE(cpp_side_connection.DidSucceed()); 453 EXPECT_TRUE(cpp_side_connection.DidSucceed());
451 } 454 }
452 455
453 } // namespace js 456 } // namespace js
454 } // namespace mojo 457 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/main.cc ('k') | net/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698