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

Side by Side Diff: gin/shell_runner_unittest.cc

Issue 1129863002: Revert of Adding task runner/ message loop to tests that use IsolateHolder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « gin/modules/timer_unittest.cc ('k') | gin/test/v8_test.h » ('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 "base/message_loop/message_loop.h"
9 #include "gin/array_buffer.h" 8 #include "gin/array_buffer.h"
10 #include "gin/converter.h" 9 #include "gin/converter.h"
11 #include "gin/public/isolate_holder.h" 10 #include "gin/public/isolate_holder.h"
12 #include "gin/v8_initializer.h" 11 #include "gin/v8_initializer.h"
13 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
14 13
15 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 14 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
16 #include "gin/public/isolate_holder.h" 15 #include "gin/public/isolate_holder.h"
17 #endif 16 #endif
18 17
19 using v8::Isolate; 18 using v8::Isolate;
20 using v8::Object; 19 using v8::Object;
21 using v8::Script; 20 using v8::Script;
22 using v8::String; 21 using v8::String;
23 22
24 namespace gin { 23 namespace gin {
25 24
26 TEST(RunnerTest, Run) { 25 TEST(RunnerTest, Run) {
27 base::MessageLoop message_loop;
28 std::string source = "this.result = 'PASS';\n"; 26 std::string source = "this.result = 'PASS';\n";
29 27
30 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 28 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
31 gin::V8Initializer::LoadV8Snapshot(); 29 gin::V8Initializer::LoadV8Snapshot();
32 #endif 30 #endif
33 31
34 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, 32 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
35 gin::ArrayBufferAllocator::SharedInstance()); 33 gin::ArrayBufferAllocator::SharedInstance());
36 gin::IsolateHolder instance; 34 gin::IsolateHolder instance;
37 35
38 ShellRunnerDelegate delegate; 36 ShellRunnerDelegate delegate;
39 Isolate* isolate = instance.isolate(); 37 Isolate* isolate = instance.isolate();
40 ShellRunner runner(&delegate, isolate); 38 ShellRunner runner(&delegate, isolate);
41 Runner::Scope scope(&runner); 39 Runner::Scope scope(&runner);
42 runner.Run(source, "test_data.js"); 40 runner.Run(source, "test_data.js");
43 41
44 std::string result; 42 std::string result;
45 EXPECT_TRUE(Converter<std::string>::FromV8(isolate, 43 EXPECT_TRUE(Converter<std::string>::FromV8(isolate,
46 runner.global()->Get(StringToV8(isolate, "result")), 44 runner.global()->Get(StringToV8(isolate, "result")),
47 &result)); 45 &result));
48 EXPECT_EQ("PASS", result); 46 EXPECT_EQ("PASS", result);
49 } 47 }
50 48
51 } // namespace gin 49 } // namespace gin
OLDNEW
« no previous file with comments | « gin/modules/timer_unittest.cc ('k') | gin/test/v8_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698