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

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

Issue 2192413002: Timeout if website never completes the transaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Marijn's comments 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 f0fb4048acc27cee6a401772abc4dca0869fd18b..5da645e13c1e9dabea50501c8cb26d63a4b24206 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequestTest.cpp
@@ -8,7 +8,6 @@
#include "bindings/core/v8/V8BindingForTesting.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
-#include "modules/payments/PaymentAddress.h"
#include "modules/payments/PaymentTestHelper.h"
#include "platform/heap/HeapAllocator.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -223,20 +222,6 @@ TEST(PaymentRequestTest, CannotCallShowTwice)
request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expectCall());
}
-TEST(PaymentRequestTest, CannotCallCompleteTwice)
-{
- V8TestingScope scope;
- PaymentRequestMockFunctionScope funcs(scope.getScriptState());
- makePaymentRequestOriginSecure(scope.document());
- PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), buildPaymentMethodDataForTest(), buildPaymentDetailsForTest(), scope.getExceptionState());
- EXPECT_FALSE(scope.getExceptionState().hadException());
- request->show(scope.getScriptState());
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse(buildPaymentResponseForTest());
- request->complete(scope.getScriptState(), Fail);
-
- request->complete(scope.getScriptState(), Success).then(funcs.expectNoCall(), funcs.expectCall());
-}
-
TEST(PaymentRequestTest, RejectShowPromiseOnErrorPaymentMethodNotSupported)
{
V8TestingScope scope;
@@ -271,56 +256,6 @@ TEST(PaymentRequestTest, RejectShowPromiseOnErrorCancelled)
EXPECT_EQ("Request cancelled", errorMessage);
}
-TEST(PaymentRequestTest, RejectCompletePromiseOnError)
-{
- V8TestingScope scope;
- PaymentRequestMockFunctionScope funcs(scope.getScriptState());
- makePaymentRequestOriginSecure(scope.document());
- PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), buildPaymentMethodDataForTest(), buildPaymentDetailsForTest(), scope.getExceptionState());
- EXPECT_FALSE(scope.getExceptionState().hadException());
- request->show(scope.getScriptState());
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse(buildPaymentResponseForTest());
-
- String errorMessage;
- request->complete(scope.getScriptState(), Success).then(funcs.expectNoCall(), funcs.expectCall(&errorMessage));
-
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError(mojom::blink::PaymentErrorReason::UNKNOWN);
-
- v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate());
- EXPECT_EQ("UnknownError: Request failed", errorMessage);
-}
-
-// If user cancels the transaction during processing, the complete() promise
-// should be rejected.
-TEST(PaymentRequestTest, RejectCompletePromiseAfterError)
-{
- V8TestingScope scope;
- PaymentRequestMockFunctionScope funcs(scope.getScriptState());
- makePaymentRequestOriginSecure(scope.document());
- PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), buildPaymentMethodDataForTest(), buildPaymentDetailsForTest(), scope.getExceptionState());
- EXPECT_FALSE(scope.getExceptionState().hadException());
- request->show(scope.getScriptState());
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse(buildPaymentResponseForTest());
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError(mojom::blink::PaymentErrorReason::USER_CANCEL);
-
- request->complete(scope.getScriptState(), Success).then(funcs.expectNoCall(), funcs.expectCall());
-}
-
-TEST(PaymentRequestTest, ResolvePromiseOnComplete)
-{
- V8TestingScope scope;
- PaymentRequestMockFunctionScope funcs(scope.getScriptState());
- makePaymentRequestOriginSecure(scope.document());
- PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), buildPaymentMethodDataForTest(), buildPaymentDetailsForTest(), scope.getExceptionState());
- EXPECT_FALSE(scope.getExceptionState().hadException());
- request->show(scope.getScriptState());
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse(buildPaymentResponseForTest());
-
- request->complete(scope.getScriptState(), Success).then(funcs.expectCall(), funcs.expectNoCall());
-
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnComplete();
-}
-
TEST(PaymentRequestTest, RejectShowPromiseOnUpdateDetailsFailure)
{
V8TestingScope scope;
@@ -338,25 +273,6 @@ TEST(PaymentRequestTest, RejectShowPromiseOnUpdateDetailsFailure)
EXPECT_EQ("AbortError: oops", errorMessage);
}
-TEST(PaymentRequestTest, RejectCompletePromiseOnUpdateDetailsFailure)
-{
- V8TestingScope scope;
- PaymentRequestMockFunctionScope funcs(scope.getScriptState());
- makePaymentRequestOriginSecure(scope.document());
- PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), buildPaymentMethodDataForTest(), buildPaymentDetailsForTest(), scope.getExceptionState());
- EXPECT_FALSE(scope.getExceptionState().hadException());
- request->show(scope.getScriptState()).then(funcs.expectCall(), funcs.expectNoCall());
- static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse(buildPaymentResponseForTest());
-
- String errorMessage;
- request->complete(scope.getScriptState(), Success).then(funcs.expectNoCall(), funcs.expectCall(&errorMessage));
-
- request->onUpdatePaymentDetailsFailure("oops");
-
- v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate());
- EXPECT_EQ("AbortError: oops", errorMessage);
-}
-
TEST(PaymentRequestTest, IgnoreUpdatePaymentDetailsAfterShowPromiseResolved)
{
V8TestingScope scope;

Powered by Google App Engine
This is Rietveld 408576698