| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 Persistent<GarbageCollectedScriptWrappable> m_scriptWrappable; | 60 Persistent<GarbageCollectedScriptWrappable> m_scriptWrappable; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 TEST_F(ToV8Test, garbageCollectedScriptWrappable) | 63 TEST_F(ToV8Test, garbageCollectedScriptWrappable) |
| 64 { | 64 { |
| 65 GarbageCollectedScriptWrappable* object = new GarbageCollectedScriptWrappabl
e("world"); | 65 GarbageCollectedScriptWrappable* object = new GarbageCollectedScriptWrappabl
e("world"); |
| 66 GarbageCollectedHolder holder(object); | 66 GarbageCollectedHolder holder(object); |
| 67 OffHeapGarbageCollectedHolder offHeapHolder(object); | 67 OffHeapGarbageCollectedHolder offHeapHolder(object); |
| 68 | 68 |
| 69 TEST_TOV8("world", object); | 69 TEST_TOV8("world", object); |
| 70 TEST_TOV8("world", RawPtr<GarbageCollectedScriptWrappable>(object)); | |
| 71 TEST_TOV8("world", holder.m_scriptWrappable); | 70 TEST_TOV8("world", holder.m_scriptWrappable); |
| 72 TEST_TOV8("world", offHeapHolder.m_scriptWrappable); | 71 TEST_TOV8("world", offHeapHolder.m_scriptWrappable); |
| 73 | 72 |
| 74 object = nullptr; | 73 object = nullptr; |
| 75 holder.m_scriptWrappable = nullptr; | 74 holder.m_scriptWrappable = nullptr; |
| 76 offHeapHolder.m_scriptWrappable = nullptr; | 75 offHeapHolder.m_scriptWrappable = nullptr; |
| 77 | 76 |
| 78 TEST_TOV8("null", object); | 77 TEST_TOV8("null", object); |
| 79 TEST_TOV8("null", RawPtr<GarbageCollectedScriptWrappable>(object)); | |
| 80 TEST_TOV8("null", holder.m_scriptWrappable); | 78 TEST_TOV8("null", holder.m_scriptWrappable); |
| 81 TEST_TOV8("null", offHeapHolder.m_scriptWrappable); | 79 TEST_TOV8("null", offHeapHolder.m_scriptWrappable); |
| 82 } | 80 } |
| 83 | 81 |
| 84 TEST_F(ToV8Test, string) | 82 TEST_F(ToV8Test, string) |
| 85 { | 83 { |
| 86 char arrayString[] = "arrayString"; | 84 char arrayString[] = "arrayString"; |
| 87 const char constArrayString[] = "constArrayString"; | 85 const char constArrayString[] = "constArrayString"; |
| 88 TEST_TOV8("arrayString", arrayString); | 86 TEST_TOV8("arrayString", arrayString); |
| 89 TEST_TOV8("constArrayString", constArrayString); | 87 TEST_TOV8("constArrayString", constArrayString); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 v8::Local<v8::Value> actual = toV8(value, m_scope.getScriptState()); | 283 v8::Local<v8::Value> actual = toV8(value, m_scope.getScriptState()); |
| 286 EXPECT_FALSE(actual.IsEmpty()); | 284 EXPECT_FALSE(actual.IsEmpty()); |
| 287 | 285 |
| 288 double actualAsNumber = actual.As<v8::Number>()->Value(); | 286 double actualAsNumber = actual.As<v8::Number>()->Value(); |
| 289 EXPECT_EQ(1234.0, actualAsNumber); | 287 EXPECT_EQ(1234.0, actualAsNumber); |
| 290 } | 288 } |
| 291 | 289 |
| 292 } // namespace | 290 } // namespace |
| 293 | 291 |
| 294 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |