Setting AudioConfiguration and deleting DeviceCapabilities hacks
[chromium-blink-merge.git] / gin / shell_runner_unittest.cc
blob07ab678b2d4cb1ce3bd81dd2b2ef9f3a9499a13c
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
3 // found in the LICENSE file.
5 #include "gin/shell_runner.h"
7 #include "base/compiler_specific.h"
8 #include "gin/array_buffer.h"
9 #include "gin/converter.h"
10 #include "gin/public/isolate_holder.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 using v8::Isolate;
14 using v8::Object;
15 using v8::Script;
16 using v8::String;
18 namespace gin {
20 TEST(RunnerTest, Run) {
21 std::string source = "this.result = 'PASS';\n";
23 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
24 gin::ArrayBufferAllocator::SharedInstance());
25 gin::IsolateHolder instance;
27 ShellRunnerDelegate delegate;
28 Isolate* isolate = instance.isolate();
29 ShellRunner runner(&delegate, isolate);
30 Runner::Scope scope(&runner);
31 runner.Run(source, "test_data.js");
33 std::string result;
34 EXPECT_TRUE(Converter<std::string>::FromV8(isolate,
35 runner.global()->Get(StringToV8(isolate, "result")),
36 &result));
37 EXPECT_EQ("PASS", result);
40 } // namespace gin