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

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

Issue 2062583002: Add totalAmount to PaymentResponse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase #2 Created 4 years, 6 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/PaymentResponseTest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp b/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp
index 5677cb40a10bd0a6b2cfb1f8577eceeab730e328..6b90b2ec1c3ae9cca7d020bea1fd477914df85c0 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentResponseTest.cpp
@@ -9,6 +9,7 @@
#include "bindings/core/v8/ScriptValue.h"
#include "core/testing/DummyPageHolder.h"
#include "modules/payments/PaymentCompleter.h"
+#include "modules/payments/PaymentTestHelper.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "wtf/OwnPtr.h"
@@ -58,8 +59,10 @@ private:
TEST_F(PaymentResponseTest, DataCopiedOver)
{
ScriptState::Scope scope(getScriptState());
- mojom::blink::PaymentResponsePtr input = mojom::blink::PaymentResponse::New();
+ mojom::blink::PaymentResponsePtr input = buildPaymentResponseForTest();
input->method_name = "foo";
+ input->total_amount->currency = "USD";
+ input->total_amount->value = "5.00";
input->stringified_details = "{\"transactionId\": 123}";
MockPaymentCompleter* completeCallback = new MockPaymentCompleter;
@@ -67,6 +70,11 @@ TEST_F(PaymentResponseTest, DataCopiedOver)
EXPECT_EQ("foo", output.methodName());
+ CurrencyAmount totalAmount;
+ output.totalAmount(totalAmount);
+ EXPECT_EQ("USD", totalAmount.currency());
+ EXPECT_EQ("5.00", totalAmount.value());
+
ScriptValue details = output.details(getScriptState(), getExceptionState());
ASSERT_FALSE(getExceptionState().hadException());
@@ -80,7 +88,7 @@ TEST_F(PaymentResponseTest, DataCopiedOver)
TEST_F(PaymentResponseTest, CompleteCalledWithSuccess)
{
- mojom::blink::PaymentResponsePtr input = mojom::blink::PaymentResponse::New();
+ mojom::blink::PaymentResponsePtr input = buildPaymentResponseForTest();
input->method_name = "foo";
input->stringified_details = "{\"transactionId\": 123}";
MockPaymentCompleter* completeCallback = new MockPaymentCompleter;
@@ -93,7 +101,7 @@ TEST_F(PaymentResponseTest, CompleteCalledWithSuccess)
TEST_F(PaymentResponseTest, CompleteCalledWithFailure)
{
- mojom::blink::PaymentResponsePtr input = mojom::blink::PaymentResponse::New();
+ mojom::blink::PaymentResponsePtr input = buildPaymentResponseForTest();
input->method_name = "foo";
input->stringified_details = "{\"transactionId\": 123}";
MockPaymentCompleter* completeCallback = new MockPaymentCompleter;

Powered by Google App Engine
This is Rietveld 408576698