Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/ReadableStreamBytesConsumerTest.cpp

Issue 2796653003: Move ScriptState::forWorld/ScriptState::forMainWorld (Part 2) (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "modules/fetch/ReadableStreamBytesConsumer.h" 5 #include "modules/fetch/ReadableStreamBytesConsumer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 protected: 43 protected:
44 MockClient() = default; 44 MockClient() = default;
45 }; 45 };
46 46
47 class ReadableStreamBytesConsumerTest : public ::testing::Test { 47 class ReadableStreamBytesConsumerTest : public ::testing::Test {
48 public: 48 public:
49 ReadableStreamBytesConsumerTest() : m_page(DummyPageHolder::create()) {} 49 ReadableStreamBytesConsumerTest() : m_page(DummyPageHolder::create()) {}
50 50
51 ScriptState* getScriptState() { 51 ScriptState* getScriptState() {
52 return ScriptState::forMainWorld(m_page->document().frame()); 52 return toScriptStateForMainWorld(m_page->document().frame());
53 } 53 }
54 v8::Isolate* isolate() { return getScriptState()->isolate(); } 54 v8::Isolate* isolate() { return getScriptState()->isolate(); }
55 55
56 v8::MaybeLocal<v8::Value> eval(const char* s) { 56 v8::MaybeLocal<v8::Value> eval(const char* s) {
57 v8::Local<v8::String> source; 57 v8::Local<v8::String> source;
58 v8::Local<v8::Script> script; 58 v8::Local<v8::Script> script;
59 v8::MicrotasksScope microtasks(isolate(), 59 v8::MicrotasksScope microtasks(isolate(),
60 v8::MicrotasksScope::kDoNotRunMicrotasks); 60 v8::MicrotasksScope::kDoNotRunMicrotasks);
61 if (!v8Call( 61 if (!v8Call(
62 v8::String::NewFromUtf8(isolate(), s, v8::NewStringType::kNormal), 62 v8::String::NewFromUtf8(isolate(), s, v8::NewStringType::kNormal),
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 checkpoint.Call(3); 370 checkpoint.Call(3);
371 testing::runPendingTasks(); 371 testing::runPendingTasks();
372 checkpoint.Call(4); 372 checkpoint.Call(4);
373 EXPECT_EQ(PublicState::Errored, consumer->getPublicState()); 373 EXPECT_EQ(PublicState::Errored, consumer->getPublicState());
374 EXPECT_EQ(Result::Error, consumer->beginRead(&buffer, &available)); 374 EXPECT_EQ(Result::Error, consumer->beginRead(&buffer, &available));
375 } 375 }
376 376
377 } // namespace 377 } // namespace
378 378
379 } // namespace blink 379 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698