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

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

Issue 2836093004: Remove V8Call and replace with v8::Maybe<T>::To and v8::MaybeLocal<T>::ToLocal. (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 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 "modules/fetch/BodyStreamBuffer.h" 5 #include "modules/fetch/BodyStreamBuffer.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/V8BindingForTesting.h" 8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/html/FormData.h" 10 #include "core/html/FormData.h"
(...skipping 23 matching lines...) Expand all
34 using MockFetchDataLoaderClient = 34 using MockFetchDataLoaderClient =
35 BytesConsumerTestUtil::MockFetchDataLoaderClient; 35 BytesConsumerTestUtil::MockFetchDataLoaderClient;
36 36
37 class BodyStreamBufferTest : public ::testing::Test { 37 class BodyStreamBufferTest : public ::testing::Test {
38 protected: 38 protected:
39 ScriptValue Eval(ScriptState* script_state, const char* s) { 39 ScriptValue Eval(ScriptState* script_state, const char* s) {
40 v8::Local<v8::String> source; 40 v8::Local<v8::String> source;
41 v8::Local<v8::Script> script; 41 v8::Local<v8::Script> script;
42 v8::MicrotasksScope microtasks(script_state->GetIsolate(), 42 v8::MicrotasksScope microtasks(script_state->GetIsolate(),
43 v8::MicrotasksScope::kDoNotRunMicrotasks); 43 v8::MicrotasksScope::kDoNotRunMicrotasks);
44 if (!V8Call(v8::String::NewFromUtf8(script_state->GetIsolate(), s, 44 if (!v8::String::NewFromUtf8(script_state->GetIsolate(), s,
45 v8::NewStringType::kNormal), 45 v8::NewStringType::kNormal)
46 source)) { 46 .ToLocal(&source)) {
47 ADD_FAILURE(); 47 ADD_FAILURE();
48 return ScriptValue(); 48 return ScriptValue();
49 } 49 }
50 if (!V8Call(v8::Script::Compile(script_state->GetContext(), source), 50 if (!v8::Script::Compile(script_state->GetContext(), source)
51 script)) { 51 .ToLocal(&script)) {
52 ADD_FAILURE() << "Compilation fails"; 52 ADD_FAILURE() << "Compilation fails";
53 return ScriptValue(); 53 return ScriptValue();
54 } 54 }
55 return ScriptValue(script_state, script->Run(script_state->GetContext())); 55 return ScriptValue(script_state, script->Run(script_state->GetContext()));
56 } 56 }
57 ScriptValue EvalWithPrintingError(ScriptState* script_state, const char* s) { 57 ScriptValue EvalWithPrintingError(ScriptState* script_state, const char* s) {
58 v8::TryCatch block(script_state->GetIsolate()); 58 v8::TryCatch block(script_state->GetIsolate());
59 ScriptValue r = Eval(script_state, s); 59 ScriptValue r = Eval(script_state, s);
60 if (block.HasCaught()) { 60 if (block.HasCaught()) {
61 ADD_FAILURE() << ToCoreString(block.Exception()->ToString( 61 ADD_FAILURE() << ToCoreString(block.Exception()->ToString(
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 ScriptValue reason(scope.GetScriptState(), 483 ScriptValue reason(scope.GetScriptState(),
484 V8String(scope.GetScriptState()->GetIsolate(), "reason")); 484 V8String(scope.GetScriptState()->GetIsolate(), "reason"));
485 EXPECT_FALSE(consumer->IsCancelled()); 485 EXPECT_FALSE(consumer->IsCancelled());
486 buffer->Cancel(scope.GetScriptState(), reason); 486 buffer->Cancel(scope.GetScriptState(), reason);
487 EXPECT_TRUE(consumer->IsCancelled()); 487 EXPECT_TRUE(consumer->IsCancelled());
488 } 488 }
489 489
490 } // namespace 490 } // namespace
491 491
492 } // namespace blink 492 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698