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

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp

Issue 2163193002: Reject payment request with AbortError if web page rejects promise from updateWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentRequest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
index 3ca10494231e058565fe64100fbc597b81032f42..617fa7d3a5a512a3cf5bc1a5c39e652a19a32b94 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
@@ -329,9 +329,13 @@ TEST(PaymentRequestTest, RejectShowPromiseOnUpdateDetailsFailure)
PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), buildPaymentMethodDataForTest(), buildPaymentDetailsForTest(), scope.getExceptionState());
EXPECT_FALSE(scope.getExceptionState().hadException());
- request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expectCall());
+ String errorMessage;
+ request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expectCall(&errorMessage));
request->onUpdatePaymentDetailsFailure(ScriptValue::from(scope.getScriptState(), "oops"));
+
+ v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate());
+ EXPECT_EQ("AbortError: oops", errorMessage);
}
TEST(PaymentRequestTest, RejectCompletePromiseOnUpdateDetailsFailure)
@@ -344,9 +348,13 @@ TEST(PaymentRequestTest, RejectCompletePromiseOnUpdateDetailsFailure)
request->show(scope.getScriptState()).then(funcs.expectCall(), funcs.expectNoCall());
static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse(buildPaymentResponseForTest());
- request->complete(scope.getScriptState(), Success).then(funcs.expectNoCall(), funcs.expectCall());
+ String errorMessage;
+ request->complete(scope.getScriptState(), Success).then(funcs.expectNoCall(), funcs.expectCall(&errorMessage));
request->onUpdatePaymentDetailsFailure(ScriptValue::from(scope.getScriptState(), "oops"));
+
+ v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate());
+ EXPECT_EQ("AbortError: oops", errorMessage);
}
TEST(PaymentRequestTest, IgnoreUpdatePaymentDetailsAfterShowPromiseResolved)
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentRequest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698