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

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

Issue 594603003: Infrastructure for reading V8's initial snapshot from external files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Ross' comments Created 6 years, 2 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
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/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "gin/array_buffer.h" 12 #include "gin/array_buffer.h"
13 #include "gin/public/isolate_holder.h" 13 #include "gin/public/isolate_holder.h"
14 #include "mojo/apps/js/mojo_runner_delegate.h" 14 #include "mojo/apps/js/mojo_runner_delegate.h"
15 #include "mojo/apps/js/test/js_to_cpp.mojom.h" 15 #include "mojo/apps/js/test/js_to_cpp.mojom.h"
16 #include "mojo/common/common_type_converters.h" 16 #include "mojo/common/common_type_converters.h"
17 #include "mojo/edk/test/test_utils.h" 17 #include "mojo/edk/test/test_utils.h"
18 #include "mojo/public/cpp/system/core.h" 18 #include "mojo/public/cpp/system/core.h"
19 #include "mojo/public/cpp/system/macros.h" 19 #include "mojo/public/cpp/system/macros.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
23 #include "gin/public/isolate_holder.h"
24 #endif
25
22 namespace mojo { 26 namespace mojo {
23 namespace js { 27 namespace js {
24 28
25 // Global value updated by some checks to prevent compilers from optimizing 29 // Global value updated by some checks to prevent compilers from optimizing
26 // reads out of existence. 30 // reads out of existence.
27 uint32 g_waste_accumulator = 0; 31 uint32 g_waste_accumulator = 0;
28 32
29 namespace { 33 namespace {
30 34
31 // Negative numbers with different values in each byte, the last of 35 // Negative numbers with different values in each byte, the last of
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 397
394 MessagePipe pipe; 398 MessagePipe pipe;
395 js_to_cpp::JsSidePtr js_side = 399 js_to_cpp::JsSidePtr js_side =
396 MakeProxy<js_to_cpp::JsSide>(pipe.handle0.Pass()); 400 MakeProxy<js_to_cpp::JsSide>(pipe.handle0.Pass());
397 js_side.set_client(cpp_side); 401 js_side.set_client(cpp_side);
398 402
399 js_side.internal_state()->router_for_testing()->EnableTestingMode(); 403 js_side.internal_state()->router_for_testing()->EnableTestingMode();
400 404
401 cpp_side->set_js_side(js_side.get()); 405 cpp_side->set_js_side(js_side.get());
402 406
407 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
408 gin::IsolateHolder::LoadV8Snapshot();
409 #endif
410
rmcilroy 2014/10/07 16:16:11 nit - remove newline
baixo 2014/10/08 11:28:55 Done.
403 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, 411 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
404 gin::ArrayBufferAllocator::SharedInstance()); 412 gin::ArrayBufferAllocator::SharedInstance());
405 gin::IsolateHolder instance; 413 gin::IsolateHolder instance;
406 apps::MojoRunnerDelegate delegate; 414 apps::MojoRunnerDelegate delegate;
407 gin::ShellRunner runner(&delegate, instance.isolate()); 415 gin::ShellRunner runner(&delegate, instance.isolate());
408 delegate.Start(&runner, pipe.handle1.release().value(), test); 416 delegate.Start(&runner, pipe.handle1.release().value(), test);
409 417
410 run_loop_.Run(); 418 run_loop_.Run();
411 } 419 }
412 420
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 if (IsRunningOnIsolatedBot()) 457 if (IsRunningOnIsolatedBot())
450 return; 458 return;
451 459
452 BackPointerCppSideConnection cpp_side_connection; 460 BackPointerCppSideConnection cpp_side_connection;
453 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection); 461 RunTest("mojo/apps/js/test/js_to_cpp_unittest", &cpp_side_connection);
454 EXPECT_TRUE(cpp_side_connection.DidSucceed()); 462 EXPECT_TRUE(cpp_side_connection.DidSucceed());
455 } 463 }
456 464
457 } // namespace js 465 } // namespace js
458 } // namespace mojo 466 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698