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

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

Issue 2145553002: Parameterize OnError method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Parameterize OnError method. 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
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 50cf1db993900ae65b9c91b4f46bb48428a9c812..d8bb53f42aba9c379e31a85804a99e0a9c09b33e 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
@@ -245,9 +245,14 @@ TEST(PaymentRequestTest, RejectShowPromiseOnError)
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 onRejected;
+ request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expectCall(&onRejected));
+
+ static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError(mojom::blink::PaymentErrorReason::NOT_SUPPORTED);
+ EXPECT_TRUE(onRejected.isNull());
please use gerrit instead 2016/07/12 15:57:35 Remove this EXPECT_TRUE(onRejected.isNull()) check
pals 2016/07/13 05:54:27 Done.
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError();
+ v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate());
+ EXPECT_EQ("NotSupportedError: The payment method is not supported.", onRejected);
}
TEST(PaymentRequestTest, RejectCompletePromiseOnError)
@@ -262,7 +267,7 @@ TEST(PaymentRequestTest, RejectCompletePromiseOnError)
request->complete(scope.getScriptState(), Success).then(funcs.expectNoCall(), funcs.expectCall());
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError();
+ static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError(mojom::blink::PaymentErrorReason::UNKNOWN);
}
// If user cancels the transaction during processing, the complete() promise
@@ -276,7 +281,7 @@ TEST(PaymentRequestTest, RejectCompletePromiseAfterError)
EXPECT_FALSE(scope.getExceptionState().hadException());
request->show(scope.getScriptState());
static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse(buildPaymentResponseForTest());
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError();
+ static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError(mojom::blink::PaymentErrorReason::USER_CANCEL);
request->complete(scope.getScriptState(), Success).then(funcs.expectNoCall(), funcs.expectCall());
}

Powered by Google App Engine
This is Rietveld 408576698