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

Side by Side Diff: gin/shell_runner_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: sync Created 6 years, 1 month 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 | « gin/shell/gin_main.cc ('k') | gin/test/file_runner.cc » ('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 "gin/shell_runner.h" 5 #include "gin/shell_runner.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "gin/array_buffer.h" 8 #include "gin/array_buffer.h"
9 #include "gin/converter.h" 9 #include "gin/converter.h"
10 #include "gin/public/isolate_holder.h" 10 #include "gin/public/isolate_holder.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
14 #include "gin/public/isolate_holder.h"
15 #endif
16
13 using v8::Isolate; 17 using v8::Isolate;
14 using v8::Object; 18 using v8::Object;
15 using v8::Script; 19 using v8::Script;
16 using v8::String; 20 using v8::String;
17 21
18 namespace gin { 22 namespace gin {
19 23
20 TEST(RunnerTest, Run) { 24 TEST(RunnerTest, Run) {
21 std::string source = "this.result = 'PASS';\n"; 25 std::string source = "this.result = 'PASS';\n";
22 26
27 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
28 gin::IsolateHolder::LoadV8Snapshot();
29 #endif
30
23 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, 31 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
24 gin::ArrayBufferAllocator::SharedInstance()); 32 gin::ArrayBufferAllocator::SharedInstance());
25 gin::IsolateHolder instance; 33 gin::IsolateHolder instance;
26 34
27 ShellRunnerDelegate delegate; 35 ShellRunnerDelegate delegate;
28 Isolate* isolate = instance.isolate(); 36 Isolate* isolate = instance.isolate();
29 ShellRunner runner(&delegate, isolate); 37 ShellRunner runner(&delegate, isolate);
30 Runner::Scope scope(&runner); 38 Runner::Scope scope(&runner);
31 runner.Run(source, "test_data.js"); 39 runner.Run(source, "test_data.js");
32 40
33 std::string result; 41 std::string result;
34 EXPECT_TRUE(Converter<std::string>::FromV8(isolate, 42 EXPECT_TRUE(Converter<std::string>::FromV8(isolate,
35 runner.global()->Get(StringToV8(isolate, "result")), 43 runner.global()->Get(StringToV8(isolate, "result")),
36 &result)); 44 &result));
37 EXPECT_EQ("PASS", result); 45 EXPECT_EQ("PASS", result);
38 } 46 }
39 47
40 } // namespace gin 48 } // namespace gin
OLDNEW
« no previous file with comments | « gin/shell/gin_main.cc ('k') | gin/test/file_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698