OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "modules/fetch/ReadableStreamDataConsumerHandle.h" | 5 #include "modules/fetch/ReadableStreamDataConsumerHandle.h" |
6 | 6 |
7 #include "bindings/core/v8/ReadableStreamOperations.h" | 7 #include "bindings/core/v8/ReadableStreamOperations.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/V8BindingMacros.h" | 9 #include "bindings/core/v8/V8BindingMacros.h" |
10 #include "bindings/core/v8/V8GCController.h" | 10 #include "bindings/core/v8/V8GCController.h" |
11 #include "bindings/core/v8/V8RecursionScope.h" | |
12 #include "core/dom/Document.h" | 11 #include "core/dom/Document.h" |
13 #include "core/testing/DummyPageHolder.h" | 12 #include "core/testing/DummyPageHolder.h" |
14 #include "modules/fetch/DataConsumerHandleTestUtil.h" | 13 #include "modules/fetch/DataConsumerHandleTestUtil.h" |
15 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
16 #include "platform/testing/UnitTestHelpers.h" | 15 #include "platform/testing/UnitTestHelpers.h" |
17 #include "public/platform/WebDataConsumerHandle.h" | 16 #include "public/platform/WebDataConsumerHandle.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
20 #include <v8.h> | 19 #include <v8.h> |
21 | 20 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 { | 52 { |
54 } | 53 } |
55 | 54 |
56 ScriptState* scriptState() { return ScriptState::forMainWorld(m_page->docume
nt().frame()); } | 55 ScriptState* scriptState() { return ScriptState::forMainWorld(m_page->docume
nt().frame()); } |
57 v8::Isolate* isolate() { return scriptState()->isolate(); } | 56 v8::Isolate* isolate() { return scriptState()->isolate(); } |
58 | 57 |
59 v8::MaybeLocal<v8::Value> eval(const char* s) | 58 v8::MaybeLocal<v8::Value> eval(const char* s) |
60 { | 59 { |
61 v8::Local<v8::String> source; | 60 v8::Local<v8::String> source; |
62 v8::Local<v8::Script> script; | 61 v8::Local<v8::Script> script; |
63 V8RecursionScope::MicrotaskSuppression microtasks(isolate()); | |
64 if (!v8Call(v8::String::NewFromUtf8(isolate(), s, v8::NewStringType::kNo
rmal), source)) { | 62 if (!v8Call(v8::String::NewFromUtf8(isolate(), s, v8::NewStringType::kNo
rmal), source)) { |
65 ADD_FAILURE(); | 63 ADD_FAILURE(); |
66 return v8::MaybeLocal<v8::Value>(); | 64 return v8::MaybeLocal<v8::Value>(); |
67 } | 65 } |
68 if (!v8Call(v8::Script::Compile(scriptState()->context(), source), scrip
t)) { | 66 if (!v8Call(v8::Script::Compile(scriptState()->context(), source), scrip
t)) { |
69 ADD_FAILURE() << "Compilation fails"; | 67 ADD_FAILURE() << "Compilation fails"; |
70 return v8::MaybeLocal<v8::Value>(); | 68 return v8::MaybeLocal<v8::Value>(); |
71 } | 69 } |
72 return script->Run(scriptState()->context()); | 70 return script->Run(scriptState()->context()); |
73 } | 71 } |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 testing::runPendingTasks(); | 515 testing::runPendingTasks(); |
518 | 516 |
519 checkpoint.Call(5); | 517 checkpoint.Call(5); |
520 EXPECT_EQ(kUnexpectedError, reader->beginRead(&buffer, kNone, &available)); | 518 EXPECT_EQ(kUnexpectedError, reader->beginRead(&buffer, kNone, &available)); |
521 } | 519 } |
522 | 520 |
523 } // namespace | 521 } // namespace |
524 | 522 |
525 } // namespace blink | 523 } // namespace blink |
526 | 524 |
OLD | NEW |