| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/serialization/V8ScriptValueSerializer.h" | 5 #include "bindings/core/v8/serialization/V8ScriptValueSerializer.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptController.h" | 8 #include "bindings/core/v8/ScriptController.h" |
| 9 #include "bindings/core/v8/ScriptSourceCode.h" | 9 #include "bindings/core/v8/ScriptSourceCode.h" |
| 10 #include "bindings/core/v8/V8BindingForTesting.h" | 10 #include "bindings/core/v8/V8BindingForTesting.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 canvas->SetPlaceholderCanvasId(519); | 517 canvas->SetPlaceholderCanvasId(519); |
| 518 v8::Local<v8::Value> wrapper = ToV8(canvas, scope.GetScriptState()); | 518 v8::Local<v8::Value> wrapper = ToV8(canvas, scope.GetScriptState()); |
| 519 Transferables transferables; | 519 Transferables transferables; |
| 520 transferables.offscreen_canvases.push_back(canvas); | 520 transferables.offscreen_canvases.push_back(canvas); |
| 521 v8::Local<v8::Value> result = | 521 v8::Local<v8::Value> result = |
| 522 RoundTrip(wrapper, scope, nullptr, &transferables); | 522 RoundTrip(wrapper, scope, nullptr, &transferables); |
| 523 ASSERT_TRUE(V8OffscreenCanvas::hasInstance(result, scope.GetIsolate())); | 523 ASSERT_TRUE(V8OffscreenCanvas::hasInstance(result, scope.GetIsolate())); |
| 524 OffscreenCanvas* new_canvas = | 524 OffscreenCanvas* new_canvas = |
| 525 V8OffscreenCanvas::toImpl(result.As<v8::Object>()); | 525 V8OffscreenCanvas::toImpl(result.As<v8::Object>()); |
| 526 EXPECT_EQ(IntSize(10, 7), new_canvas->Size()); | 526 EXPECT_EQ(IntSize(10, 7), new_canvas->Size()); |
| 527 EXPECT_EQ(519, new_canvas->PlaceholderCanvasId()); | 527 EXPECT_EQ(519u, new_canvas->PlaceholderCanvasId()); |
| 528 EXPECT_TRUE(canvas->IsNeutered()); | 528 EXPECT_TRUE(canvas->IsNeutered()); |
| 529 EXPECT_FALSE(new_canvas->IsNeutered()); | 529 EXPECT_FALSE(new_canvas->IsNeutered()); |
| 530 } | 530 } |
| 531 | 531 |
| 532 TEST(V8ScriptValueSerializerTest, RoundTripBlob) { | 532 TEST(V8ScriptValueSerializerTest, RoundTripBlob) { |
| 533 V8TestingScope scope; | 533 V8TestingScope scope; |
| 534 const char kHelloWorld[] = "Hello world!"; | 534 const char kHelloWorld[] = "Hello world!"; |
| 535 Blob* blob = | 535 Blob* blob = |
| 536 Blob::Create(reinterpret_cast<const unsigned char*>(&kHelloWorld), | 536 Blob::Create(reinterpret_cast<const unsigned char*>(&kHelloWorld), |
| 537 sizeof(kHelloWorld), "text/plain"); | 537 sizeof(kHelloWorld), "text/plain"); |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 RefPtr<SerializedScriptValue> input = | 1101 RefPtr<SerializedScriptValue> input = |
| 1102 SerializedValue({0xff, 0x80, 0x09, 0xff, 0x09, 0x54}); | 1102 SerializedValue({0xff, 0x80, 0x09, 0xff, 0x09, 0x54}); |
| 1103 EXPECT_TRUE( | 1103 EXPECT_TRUE( |
| 1104 V8ScriptValueDeserializer(scope.GetScriptState(), std::move(input)) | 1104 V8ScriptValueDeserializer(scope.GetScriptState(), std::move(input)) |
| 1105 .Deserialize() | 1105 .Deserialize() |
| 1106 ->IsTrue()); | 1106 ->IsTrue()); |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 } // namespace | 1109 } // namespace |
| 1110 } // namespace blink | 1110 } // namespace blink |
| OLD | NEW |