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