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 "platform/heap/Heap.h" | 10 #include "platform/heap/Heap.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 String actualString = toCoreString(actual->ToString(m_scope.context()).T
oLocalChecked()); | 33 String actualString = toCoreString(actual->ToString(m_scope.context()).T
oLocalChecked()); |
34 if (String(expected) != actualString) { | 34 if (String(expected) != actualString) { |
35 ADD_FAILURE_AT(path, lineNumber) << "toV8 returns an incorrect value
.\n Actual: " << actualString.utf8().data() << "\nExpected: " << expected; | 35 ADD_FAILURE_AT(path, lineNumber) << "toV8 returns an incorrect value
.\n Actual: " << actualString.utf8().data() << "\nExpected: " << expected; |
36 return; | 36 return; |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 V8TestingScope m_scope; | 40 V8TestingScope m_scope; |
41 }; | 41 }; |
42 | 42 |
43 class GarbageCollectedHolder : public GarbageCollectedFinalized<GarbageCollected
Holder> { | 43 class GarbageCollectedHolder : public GarbageCollected<GarbageCollectedHolder> { |
44 public: | 44 public: |
45 GarbageCollectedHolder(GarbageCollectedScriptWrappable* scriptWrappable) | 45 GarbageCollectedHolder(GarbageCollectedScriptWrappable* scriptWrappable) |
46 : m_scriptWrappable(scriptWrappable) { } | 46 : m_scriptWrappable(scriptWrappable) { } |
47 | 47 |
48 DEFINE_INLINE_TRACE() { visitor->trace(m_scriptWrappable); } | 48 DEFINE_INLINE_TRACE() { visitor->trace(m_scriptWrappable); } |
49 | 49 |
50 // This should be public in order to access a Member<X> object. | 50 // This should be public in order to access a Member<X> object. |
51 Member<GarbageCollectedScriptWrappable> m_scriptWrappable; | 51 Member<GarbageCollectedScriptWrappable> m_scriptWrappable; |
52 }; | 52 }; |
53 | 53 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 v8::Local<v8::Value> actual = toV8(value, m_scope.getScriptState()); | 231 v8::Local<v8::Value> actual = toV8(value, m_scope.getScriptState()); |
232 EXPECT_FALSE(actual.IsEmpty()); | 232 EXPECT_FALSE(actual.IsEmpty()); |
233 | 233 |
234 double actualAsNumber = actual.As<v8::Number>()->Value(); | 234 double actualAsNumber = actual.As<v8::Number>()->Value(); |
235 EXPECT_EQ(1234.0, actualAsNumber); | 235 EXPECT_EQ(1234.0, actualAsNumber); |
236 } | 236 } |
237 | 237 |
238 } // namespace | 238 } // namespace |
239 | 239 |
240 } // namespace blink | 240 } // namespace blink |
OLD | NEW |