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/ToV8.h" | 5 #include "bindings/core/v8/ToV8.h" |
6 | 6 |
7 #include "bindings/core/v8/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
8 #include "bindings/core/v8/V8BindingForTesting.h" | 8 #include "bindings/core/v8/V8BindingForTesting.h" |
9 #include "core/testing/GarbageCollectedScriptWrappable.h" | 9 #include "core/testing/GarbageCollectedScriptWrappable.h" |
10 #include "core/testing/RefCountedScriptWrappable.h" | 10 #include "core/testing/RefCountedScriptWrappable.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 doubleVector.append(4.2); | 296 doubleVector.append(4.2); |
297 TEST_TOV8("2.3,4.2", doubleVector); | 297 TEST_TOV8("2.3,4.2", doubleVector); |
298 | 298 |
299 HeapVector<bool> boolVector; | 299 HeapVector<bool> boolVector; |
300 boolVector.append(true); | 300 boolVector.append(true); |
301 boolVector.append(true); | 301 boolVector.append(true); |
302 boolVector.append(false); | 302 boolVector.append(false); |
303 TEST_TOV8("true,true,false", boolVector); | 303 TEST_TOV8("true,true,false", boolVector); |
304 } | 304 } |
305 | 305 |
| 306 TEST_F(ToV8Test, withScriptState) |
| 307 { |
| 308 ScriptValue value(m_scope.scriptState(), v8::Number::New(m_scope.isolate(),
1234.0)); |
| 309 |
| 310 v8::Local<v8::Value> actual = toV8(value, m_scope.scriptState()); |
| 311 EXPECT_FALSE(actual.IsEmpty()); |
| 312 |
| 313 double actualAsNumber = actual.As<v8::Number>()->Value(); |
| 314 EXPECT_EQ(1234.0, actualAsNumber); |
| 315 } |
| 316 |
306 } // namespace | 317 } // namespace |
307 | 318 |
308 } // namespace blink | 319 } // namespace blink |
OLD | NEW |