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

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: 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..5344ff343bc9416d17da5f87f25de425bd48c32c 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"
@@ -27,6 +29,7 @@ public:
MOCK_METHOD1(onUpdatePaymentDetails, void(const ScriptValue& detailsScriptValue));
MOCK_METHOD1(onUpdatePaymentDetailsFailure, void(const ScriptValue& error));
please use gerrit instead 2016/07/29 15:40:50 Change ScriptValue to String
pals 2016/08/01 11:18:23 Done.
+ MOCK_METHOD1(abortPaymentRequest, void(const String& message));
please use gerrit instead 2016/07/29 15:40:50 No need for the extra method.
pals 2016/08/01 11:18:23 Done.
DEFINE_INLINE_TRACE() {}
};
@@ -104,14 +107,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);
please use gerrit instead 2016/07/29 15:40:50 Great test!
pals 2016/08/01 11:18:23 Thanks.
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698