OLD | NEW |
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 "bindings/core/v8/V8Binding.h" | 5 #include "bindings/core/v8/V8Binding.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ToV8.h" | 8 #include "bindings/core/v8/ToV8.h" |
9 #include "bindings/core/v8/V8BindingForTesting.h" | 9 #include "bindings/core/v8/V8BindingForTesting.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "wtf/Vector.h" | 11 #include "wtf/Vector.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class V8BindingTest : public ::testing::Test { | 17 class V8BindingTest : public ::testing::Test { |
18 public: | 18 public: |
19 V8BindingTest() : m_scope(v8::Isolate::GetCurrent()) { } | 19 V8BindingTest() : m_scope(v8::Isolate::GetCurrent()) { } |
20 | 20 |
21 template<typename T> v8::Local<v8::Value> toV8(T value) | 21 template<typename T> v8::Local<v8::Value> toV8(T value) |
22 { | 22 { |
23 return blink::toV8(value, m_scope.scriptState()->context()->Global(), m_
scope.isolate()); | 23 return blink::toV8(value, m_scope.getScriptState()->context()->Global(),
m_scope.isolate()); |
24 } | 24 } |
25 | 25 |
26 V8TestingScope m_scope; | 26 V8TestingScope m_scope; |
27 }; | 27 }; |
28 | 28 |
29 TEST_F(V8BindingTest, toImplArray) | 29 TEST_F(V8BindingTest, toImplArray) |
30 { | 30 { |
31 { | 31 { |
32 v8::Local<v8::Array> v8StringArray = v8::Array::New(m_scope.isolate(), 2
); | 32 v8::Local<v8::Array> v8StringArray = v8::Array::New(m_scope.isolate(), 2
); |
33 EXPECT_TRUE(v8CallBoolean(v8StringArray->Set(m_scope.context(), toV8(0),
toV8("Hello, World!")))); | 33 EXPECT_TRUE(v8CallBoolean(v8StringArray->Set(m_scope.context(), toV8(0),
toV8("Hello, World!")))); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 EXPECT_EQ(3U, stringVectorVector[1].size()); | 107 EXPECT_EQ(3U, stringVectorVector[1].size()); |
108 EXPECT_EQ("x", stringVectorVector[1][0]); | 108 EXPECT_EQ("x", stringVectorVector[1][0]); |
109 EXPECT_EQ("y", stringVectorVector[1][1]); | 109 EXPECT_EQ("y", stringVectorVector[1][1]); |
110 EXPECT_EQ("z", stringVectorVector[1][2]); | 110 EXPECT_EQ("z", stringVectorVector[1][2]); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 } // namespace | 114 } // namespace |
115 | 115 |
116 } // namespace blink | 116 } // namespace blink |
OLD | NEW |