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

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

Issue 2193183002: Print proper debug message in case of change event timeout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review 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/PaymentRequestUpdateEventTest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp
index 3e72fe9d2d4fd4dd10b65bee278ada227f9e9647..c58cf337151dc843d8c2d018486fc949c0b03dd5 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEventTest.cpp
@@ -9,6 +9,8 @@
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/V8BindingForTesting.h"
#include "core/EventTypeNames.h"
+#include "modules/payments/PaymentRequest.h"
+#include "modules/payments/PaymentTestHelper.h"
#include "modules/payments/PaymentUpdater.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -26,7 +28,7 @@ public:
~MockPaymentUpdater() override {}
MOCK_METHOD1(onUpdatePaymentDetails, void(const ScriptValue& detailsScriptValue));
- MOCK_METHOD1(onUpdatePaymentDetailsFailure, void(const ScriptValue& error));
+ MOCK_METHOD1(onUpdatePaymentDetailsFailure, void(const String& error));
DEFINE_INLINE_TRACE() {}
};
@@ -104,14 +106,20 @@ TEST(PaymentRequestUpdateEventTest, UpdaterNotRequired)
TEST(PaymentRequestUpdateEventTest, OnUpdatePaymentDetailsTimeout)
{
V8TestingScope scope;
+ PaymentRequestMockFunctionScope funcs(scope.getScriptState());
+ makePaymentRequestOriginSecure(scope.document());
+ PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), buildPaymentMethodDataForTest(), buildPaymentDetailsForTest(), scope.getExceptionState());
PaymentRequestUpdateEvent* event = PaymentRequestUpdateEvent::create();
- MockPaymentUpdater* updater = new MockPaymentUpdater;
- event->setPaymentDetailsUpdater(updater);
+ event->setPaymentDetailsUpdater(request);
+ EXPECT_FALSE(scope.getExceptionState().hadException());
- EXPECT_CALL(*updater, onUpdatePaymentDetails(testing::_)).Times(0);
- EXPECT_CALL(*updater, onUpdatePaymentDetailsFailure(testing::_));
+ String errorMessage;
+ request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expectCall(&errorMessage));
event->onTimerFired(0);
+
+ v8::MicrotasksScope::PerformCheckpoint(scope.getScriptState()->isolate());
+ EXPECT_EQ("AbortError: Timed out as the page didn't resolve the promise from change event", errorMessage);
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698