| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/payments/PaymentRequest.h" | 5 #include "modules/payments/PaymentRequest.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | |
| 8 #include "bindings/core/v8/JSONValuesForV8.h" | 7 #include "bindings/core/v8/JSONValuesForV8.h" |
| 8 #include "bindings/core/v8/ScriptFunction.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/modules/v8/V8PaymentResponse.h" | 10 #include "bindings/modules/v8/V8PaymentResponse.h" |
| 11 #include "core/dom/ExceptionCode.h" | 11 #include "core/dom/ExceptionCode.h" |
| 12 #include "core/testing/DummyPageHolder.h" | |
| 13 #include "modules/payments/CurrencyAmount.h" | |
| 14 #include "modules/payments/PaymentAddress.h" | 12 #include "modules/payments/PaymentAddress.h" |
| 15 #include "modules/payments/PaymentItem.h" | 13 #include "modules/payments/PaymentRequestTestBase.h" |
| 14 #include "modules/payments/PaymentResponse.h" |
| 16 #include "modules/payments/PaymentTestHelper.h" | 15 #include "modules/payments/PaymentTestHelper.h" |
| 17 #include "modules/payments/ShippingOption.h" | |
| 18 #include "platform/heap/HeapAllocator.h" | 16 #include "platform/heap/HeapAllocator.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "wtf/OwnPtr.h" | |
| 22 #include <utility> | 18 #include <utility> |
| 23 | 19 |
| 24 namespace blink { | 20 namespace blink { |
| 25 namespace { | 21 namespace { |
| 26 | 22 |
| 27 class PaymentRequestTest : public testing::Test { | 23 class PaymentRequestTest : public PaymentRequestTestBase { |
| 28 public: | |
| 29 PaymentRequestTest() | |
| 30 : m_page(DummyPageHolder::create()) | |
| 31 { | |
| 32 setSecurityOrigin("https://www.example.com/"); | |
| 33 } | |
| 34 | |
| 35 ~PaymentRequestTest() override {} | |
| 36 | |
| 37 ScriptState* getScriptState() { return ScriptState::forMainWorld(m_page->doc
ument().frame()); } | |
| 38 ExceptionState& getExceptionState() { return m_exceptionState; } | |
| 39 | |
| 40 void setSecurityOrigin(const String& securityOrigin) | |
| 41 { | |
| 42 m_page->document().setSecurityOrigin(SecurityOrigin::create(KURL(KURL(),
securityOrigin))); | |
| 43 } | |
| 44 | |
| 45 private: | |
| 46 OwnPtr<DummyPageHolder> m_page; | |
| 47 TrackExceptionState m_exceptionState; | |
| 48 }; | 24 }; |
| 49 | 25 |
| 50 TEST_F(PaymentRequestTest, NoExceptionWithValidData) | 26 TEST_F(PaymentRequestTest, NoExceptionWithValidData) |
| 51 { | 27 { |
| 52 PaymentRequest::create(getScriptState(), buildPaymentMethodDataForTest(), bu
ildPaymentDetailsForTest(), getExceptionState()); | 28 PaymentRequest::create(getScriptState(), buildPaymentMethodDataForTest(), bu
ildPaymentDetailsForTest(), getExceptionState()); |
| 53 | 29 |
| 54 EXPECT_FALSE(getExceptionState().hadException()); | 30 EXPECT_FALSE(getExceptionState().hadException()); |
| 55 } | 31 } |
| 56 | 32 |
| 57 TEST_F(PaymentRequestTest, SecureContextRequired) | 33 TEST_F(PaymentRequestTest, SecureContextRequired) |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 shippingOptions[1].setSelected(true); | 161 shippingOptions[1].setSelected(true); |
| 186 details.setShippingOptions(shippingOptions); | 162 details.setShippingOptions(shippingOptions); |
| 187 PaymentOptions options; | 163 PaymentOptions options; |
| 188 options.setRequestShipping(true); | 164 options.setRequestShipping(true); |
| 189 | 165 |
| 190 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), details, options, getExceptionState()); | 166 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), details, options, getExceptionState()); |
| 191 | 167 |
| 192 EXPECT_EQ("express", request->shippingOption()); | 168 EXPECT_EQ("express", request->shippingOption()); |
| 193 } | 169 } |
| 194 | 170 |
| 195 TEST_F(PaymentRequestTest, AbortWithoutShowShouldThrow) | |
| 196 { | |
| 197 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | |
| 198 EXPECT_FALSE(getExceptionState().hadException()); | |
| 199 | |
| 200 request->abort(getExceptionState()); | |
| 201 EXPECT_TRUE(getExceptionState().hadException()); | |
| 202 } | |
| 203 | |
| 204 class MockFunction : public ScriptFunction { | |
| 205 public: | |
| 206 static v8::Local<v8::Function> noExpectations(ScriptState* scriptState) | |
| 207 { | |
| 208 MockFunction* self = new MockFunction(scriptState); | |
| 209 return self->bindToV8Function(); | |
| 210 } | |
| 211 | |
| 212 static v8::Local<v8::Function> expectCall(ScriptState* scriptState) | |
| 213 { | |
| 214 MockFunction* self = new MockFunction(scriptState); | |
| 215 EXPECT_CALL(*self, call(testing::_)); | |
| 216 return self->bindToV8Function(); | |
| 217 } | |
| 218 | |
| 219 static v8::Local<v8::Function> expectNoCall(ScriptState* scriptState) | |
| 220 { | |
| 221 MockFunction* self = new MockFunction(scriptState); | |
| 222 EXPECT_CALL(*self, call(testing::_)).Times(0); | |
| 223 return self->bindToV8Function(); | |
| 224 } | |
| 225 | |
| 226 private: | |
| 227 explicit MockFunction(ScriptState* scriptState) | |
| 228 : ScriptFunction(scriptState) | |
| 229 { | |
| 230 ON_CALL(*this, call(testing::_)).WillByDefault(testing::ReturnArg<0>()); | |
| 231 } | |
| 232 | |
| 233 MOCK_METHOD1(call, ScriptValue(ScriptValue)); | |
| 234 }; | |
| 235 | |
| 236 class PaymentResponseFunction : public ScriptFunction { | |
| 237 public: | |
| 238 static v8::Local<v8::Function> create(ScriptState* scriptState, ScriptValue*
outValue) | |
| 239 { | |
| 240 PaymentResponseFunction* self = new PaymentResponseFunction(scriptState,
outValue); | |
| 241 return self->bindToV8Function(); | |
| 242 } | |
| 243 | |
| 244 ScriptValue call(ScriptValue value) override | |
| 245 { | |
| 246 DCHECK(!value.isEmpty()); | |
| 247 *m_value = value; | |
| 248 return value; | |
| 249 } | |
| 250 | |
| 251 private: | |
| 252 PaymentResponseFunction(ScriptState* scriptState, ScriptValue* outValue) | |
| 253 : ScriptFunction(scriptState) | |
| 254 , m_value(outValue) | |
| 255 { | |
| 256 DCHECK(m_value); | |
| 257 } | |
| 258 | |
| 259 ScriptValue* m_value; | |
| 260 }; | |
| 261 | |
| 262 TEST_F(PaymentRequestTest, CanAbortAfterShow) | |
| 263 { | |
| 264 ScriptState::Scope scope(getScriptState()); | |
| 265 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | |
| 266 EXPECT_FALSE(getExceptionState().hadException()); | |
| 267 | |
| 268 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::noExpectations(getScriptState())); | |
| 269 request->abort(getExceptionState()); | |
| 270 | |
| 271 EXPECT_FALSE(getExceptionState().hadException()); | |
| 272 } | |
| 273 | |
| 274 TEST_F(PaymentRequestTest, RejectShowPromiseOnInvalidShippingAddress) | 171 TEST_F(PaymentRequestTest, RejectShowPromiseOnInvalidShippingAddress) |
| 275 { | 172 { |
| 276 ScriptState::Scope scope(getScriptState()); | 173 ScriptState::Scope scope(getScriptState()); |
| 277 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 174 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 278 EXPECT_FALSE(getExceptionState().hadException()); | 175 EXPECT_FALSE(getExceptionState().hadException()); |
| 279 | 176 |
| 280 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectCall(getScriptState())); | 177 request->show(getScriptState()).then(expectNoCall(), expectCall()); |
| 281 | 178 |
| 282 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnShippingAddress
Change(mojom::blink::PaymentAddress::New()); | 179 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnShippingAddress
Change(mojom::blink::PaymentAddress::New()); |
| 283 } | 180 } |
| 284 | 181 |
| 285 TEST_F(PaymentRequestTest, RejectShowPromiseWithRequestShippingTrueAndEmptyShipp
ingAddressInResponse) | 182 TEST_F(PaymentRequestTest, RejectShowPromiseWithRequestShippingTrueAndEmptyShipp
ingAddressInResponse) |
| 286 { | 183 { |
| 287 ScriptState::Scope scope(getScriptState()); | 184 ScriptState::Scope scope(getScriptState()); |
| 288 PaymentOptions options; | 185 PaymentOptions options; |
| 289 options.setRequestShipping(true); | 186 options.setRequestShipping(true); |
| 290 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); | 187 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); |
| 291 EXPECT_FALSE(getExceptionState().hadException()); | 188 EXPECT_FALSE(getExceptionState().hadException()); |
| 292 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 189 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
| 293 | 190 |
| 294 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectCall(getScriptState())); | 191 request->show(getScriptState()).then(expectNoCall(), expectCall()); |
| 295 | 192 |
| 296 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 193 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
| 297 } | 194 } |
| 298 | 195 |
| 299 TEST_F(PaymentRequestTest, RejectShowPromiseWithRequestShippingTrueAndInvalidShi
ppingAddressInResponse) | 196 TEST_F(PaymentRequestTest, RejectShowPromiseWithRequestShippingTrueAndInvalidShi
ppingAddressInResponse) |
| 300 { | 197 { |
| 301 ScriptState::Scope scope(getScriptState()); | 198 ScriptState::Scope scope(getScriptState()); |
| 302 PaymentOptions options; | 199 PaymentOptions options; |
| 303 options.setRequestShipping(true); | 200 options.setRequestShipping(true); |
| 304 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); | 201 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); |
| 305 EXPECT_FALSE(getExceptionState().hadException()); | 202 EXPECT_FALSE(getExceptionState().hadException()); |
| 306 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 203 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
| 307 response->shipping_address = mojom::blink::PaymentAddress::New(); | 204 response->shipping_address = mojom::blink::PaymentAddress::New(); |
| 308 | 205 |
| 309 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectCall(getScriptState())); | 206 request->show(getScriptState()).then(expectNoCall(), expectCall()); |
| 310 | 207 |
| 311 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 208 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
| 312 } | 209 } |
| 313 | 210 |
| 314 TEST_F(PaymentRequestTest, RejectShowPromiseWithRequestShippingFalseAndShippingA
ddressExistsInResponse) | 211 TEST_F(PaymentRequestTest, RejectShowPromiseWithRequestShippingFalseAndShippingA
ddressExistsInResponse) |
| 315 { | 212 { |
| 316 ScriptState::Scope scope(getScriptState()); | 213 ScriptState::Scope scope(getScriptState()); |
| 317 PaymentOptions options; | 214 PaymentOptions options; |
| 318 options.setRequestShipping(false); | 215 options.setRequestShipping(false); |
| 319 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); | 216 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); |
| 320 EXPECT_FALSE(getExceptionState().hadException()); | 217 EXPECT_FALSE(getExceptionState().hadException()); |
| 321 mojom::blink::PaymentAddressPtr shippingAddress = mojom::blink::PaymentAddre
ss::New(); | 218 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
| 322 shippingAddress->country = "US"; | 219 response->shipping_address = mojom::blink::PaymentAddress::New(); |
| 323 shippingAddress->language_code = "en"; | 220 response->shipping_address->country = "US"; |
| 324 shippingAddress->script_code = "Latn"; | 221 response->shipping_address->language_code = "en"; |
| 222 response->shipping_address->script_code = "Latn"; |
| 325 | 223 |
| 326 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectCall(getScriptState())); | 224 request->show(getScriptState()).then(expectNoCall(), expectCall()); |
| 327 | 225 |
| 328 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnShippingAddress
Change(std::move(shippingAddress)); | 226 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
| 329 } | 227 } |
| 330 | 228 |
| 229 class PaymentResponseFunction : public ScriptFunction { |
| 230 public: |
| 231 static v8::Local<v8::Function> create(ScriptState* scriptState, ScriptValue*
outValue) |
| 232 { |
| 233 PaymentResponseFunction* self = new PaymentResponseFunction(scriptState,
outValue); |
| 234 return self->bindToV8Function(); |
| 235 } |
| 236 |
| 237 ScriptValue call(ScriptValue value) override |
| 238 { |
| 239 DCHECK(!value.isEmpty()); |
| 240 *m_value = value; |
| 241 return value; |
| 242 } |
| 243 |
| 244 private: |
| 245 PaymentResponseFunction(ScriptState* scriptState, ScriptValue* outValue) |
| 246 : ScriptFunction(scriptState) |
| 247 , m_value(outValue) |
| 248 { |
| 249 DCHECK(m_value); |
| 250 } |
| 251 |
| 252 ScriptValue* m_value; |
| 253 }; |
| 254 |
| 331 TEST_F(PaymentRequestTest, ResolveShowPromiseWithRequestShippingTrueAndValidShip
pingAddressInResponse) | 255 TEST_F(PaymentRequestTest, ResolveShowPromiseWithRequestShippingTrueAndValidShip
pingAddressInResponse) |
| 332 { | 256 { |
| 333 ScriptState::Scope scope(getScriptState()); | 257 ScriptState::Scope scope(getScriptState()); |
| 334 PaymentOptions options; | 258 PaymentOptions options; |
| 335 options.setRequestShipping(true); | 259 options.setRequestShipping(true); |
| 336 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); | 260 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); |
| 337 EXPECT_FALSE(getExceptionState().hadException()); | 261 EXPECT_FALSE(getExceptionState().hadException()); |
| 338 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); | 262 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N
ew(); |
| 339 response->shipping_address = mojom::blink::PaymentAddress::New(); | 263 response->shipping_address = mojom::blink::PaymentAddress::New(); |
| 340 response->shipping_address->country = "US"; | 264 response->shipping_address->country = "US"; |
| 341 response->shipping_address->language_code = "en"; | 265 response->shipping_address->language_code = "en"; |
| 342 response->shipping_address->script_code = "Latn"; | 266 response->shipping_address->script_code = "Latn"; |
| 343 | 267 |
| 344 ScriptValue outValue; | 268 ScriptValue outValue; |
| 345 request->show(getScriptState()).then(PaymentResponseFunction::create(getScri
ptState(), &outValue), MockFunction::expectNoCall(getScriptState())); | 269 request->show(getScriptState()).then(PaymentResponseFunction::create(getScri
ptState(), &outValue), expectNoCall()); |
| 346 | 270 |
| 347 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); | 271 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(std::move(response)); |
| 348 v8::MicrotasksScope::PerformCheckpoint(getScriptState()->isolate()); | 272 firePromiseCallbacks(); |
| 349 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(getScriptState(
)->isolate(), outValue.v8Value()); | 273 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(getScriptState(
)->isolate(), outValue.v8Value()); |
| 350 | 274 |
| 351 EXPECT_EQ("US", pr->shippingAddress()->country()); | 275 EXPECT_EQ("US", pr->shippingAddress()->country()); |
| 352 EXPECT_EQ("en-Latn", pr->shippingAddress()->languageCode()); | 276 EXPECT_EQ("en-Latn", pr->shippingAddress()->languageCode()); |
| 353 } | 277 } |
| 354 | 278 |
| 355 TEST_F(PaymentRequestTest, ResolveShowPromiseWithRequestShippingFalseAndEmptyShi
ppingAddressInResponse) | 279 TEST_F(PaymentRequestTest, ResolveShowPromiseWithRequestShippingFalseAndEmptyShi
ppingAddressInResponse) |
| 356 { | 280 { |
| 357 ScriptState::Scope scope(getScriptState()); | 281 ScriptState::Scope scope(getScriptState()); |
| 358 PaymentOptions options; | 282 PaymentOptions options; |
| 359 options.setRequestShipping(false); | 283 options.setRequestShipping(false); |
| 360 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); | 284 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); |
| 361 EXPECT_FALSE(getExceptionState().hadException()); | 285 EXPECT_FALSE(getExceptionState().hadException()); |
| 362 | 286 |
| 363 ScriptValue outValue; | 287 ScriptValue outValue; |
| 364 request->show(getScriptState()).then(PaymentResponseFunction::create(getScri
ptState(), &outValue), MockFunction::expectNoCall(getScriptState())); | 288 request->show(getScriptState()).then(PaymentResponseFunction::create(getScri
ptState(), &outValue), expectNoCall()); |
| 365 | 289 |
| 366 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); | 290 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); |
| 367 v8::MicrotasksScope::PerformCheckpoint(getScriptState()->isolate()); | 291 firePromiseCallbacks(); |
| 368 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(getScriptState(
)->isolate(), outValue.v8Value()); | 292 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(getScriptState(
)->isolate(), outValue.v8Value()); |
| 369 | 293 |
| 370 EXPECT_EQ(nullptr, pr->shippingAddress()); | 294 EXPECT_EQ(nullptr, pr->shippingAddress()); |
| 371 } | 295 } |
| 372 | 296 |
| 373 TEST_F(PaymentRequestTest, OnShippingOptionChange) | 297 TEST_F(PaymentRequestTest, OnShippingOptionChange) |
| 374 { | 298 { |
| 375 ScriptState::Scope scope(getScriptState()); | 299 ScriptState::Scope scope(getScriptState()); |
| 376 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 300 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 377 EXPECT_FALSE(getExceptionState().hadException()); | 301 EXPECT_FALSE(getExceptionState().hadException()); |
| 378 | 302 |
| 379 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectNoCall(getScriptState())); | 303 request->show(getScriptState()).then(expectNoCall(), expectNoCall()); |
| 380 | 304 |
| 381 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnShippingOptionC
hange("standardShipping"); | 305 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnShippingOptionC
hange("standardShipping"); |
| 382 } | 306 } |
| 383 | 307 |
| 384 TEST_F(PaymentRequestTest, CannotCallShowTwice) | 308 TEST_F(PaymentRequestTest, CannotCallShowTwice) |
| 385 { | 309 { |
| 386 ScriptState::Scope scope(getScriptState()); | 310 ScriptState::Scope scope(getScriptState()); |
| 387 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 311 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 388 EXPECT_FALSE(getExceptionState().hadException()); | 312 EXPECT_FALSE(getExceptionState().hadException()); |
| 389 request->show(getScriptState()); | 313 request->show(getScriptState()); |
| 390 | 314 |
| 391 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectCall(getScriptState())); | 315 request->show(getScriptState()).then(expectNoCall(), expectCall()); |
| 392 } | 316 } |
| 393 | 317 |
| 394 TEST_F(PaymentRequestTest, CannotCallCompleteTwice) | 318 TEST_F(PaymentRequestTest, CannotCallCompleteTwice) |
| 395 { | 319 { |
| 396 ScriptState::Scope scope(getScriptState()); | 320 ScriptState::Scope scope(getScriptState()); |
| 397 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 321 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 398 EXPECT_FALSE(getExceptionState().hadException()); | 322 EXPECT_FALSE(getExceptionState().hadException()); |
| 399 request->show(getScriptState()); | 323 request->show(getScriptState()); |
| 400 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); | 324 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); |
| 401 request->complete(getScriptState(), false); | 325 request->complete(getScriptState(), false); |
| 402 | 326 |
| 403 request->complete(getScriptState(), true).then(MockFunction::expectNoCall(ge
tScriptState()), MockFunction::expectCall(getScriptState())); | 327 request->complete(getScriptState(), true).then(expectNoCall(), expectCall())
; |
| 404 } | 328 } |
| 405 | 329 |
| 406 TEST_F(PaymentRequestTest, RejectShowPromiseOnError) | 330 TEST_F(PaymentRequestTest, RejectShowPromiseOnError) |
| 407 { | 331 { |
| 408 ScriptState::Scope scope(getScriptState()); | 332 ScriptState::Scope scope(getScriptState()); |
| 409 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 333 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 410 EXPECT_FALSE(getExceptionState().hadException()); | 334 EXPECT_FALSE(getExceptionState().hadException()); |
| 411 | 335 |
| 412 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectCall(getScriptState())); | 336 request->show(getScriptState()).then(expectNoCall(), expectCall()); |
| 413 | 337 |
| 414 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError(); | 338 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError(); |
| 415 } | 339 } |
| 416 | 340 |
| 417 TEST_F(PaymentRequestTest, RejectCompletePromiseOnError) | 341 TEST_F(PaymentRequestTest, RejectCompletePromiseOnError) |
| 418 { | 342 { |
| 419 ScriptState::Scope scope(getScriptState()); | 343 ScriptState::Scope scope(getScriptState()); |
| 420 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 344 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 421 EXPECT_FALSE(getExceptionState().hadException()); | 345 EXPECT_FALSE(getExceptionState().hadException()); |
| 422 request->show(getScriptState()); | 346 request->show(getScriptState()); |
| 423 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); | 347 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); |
| 424 | 348 |
| 425 request->complete(getScriptState(), true).then(MockFunction::expectNoCall(ge
tScriptState()), MockFunction::expectCall(getScriptState())); | 349 request->complete(getScriptState(), true).then(expectNoCall(), expectCall())
; |
| 426 | 350 |
| 427 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError(); | 351 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnError(); |
| 428 } | 352 } |
| 429 | 353 |
| 430 TEST_F(PaymentRequestTest, ResolvePromiseOnComplete) | 354 TEST_F(PaymentRequestTest, ResolvePromiseOnComplete) |
| 431 { | 355 { |
| 432 ScriptState::Scope scope(getScriptState()); | 356 ScriptState::Scope scope(getScriptState()); |
| 433 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 357 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 434 EXPECT_FALSE(getExceptionState().hadException()); | 358 EXPECT_FALSE(getExceptionState().hadException()); |
| 435 request->show(getScriptState()); | 359 request->show(getScriptState()); |
| 436 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); | 360 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); |
| 437 | 361 |
| 438 request->complete(getScriptState(), true).then(MockFunction::expectCall(getS
criptState()), MockFunction::expectNoCall(getScriptState())); | 362 request->complete(getScriptState(), true).then(expectCall(), expectNoCall())
; |
| 439 | 363 |
| 440 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnComplete(); | 364 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnComplete(); |
| 441 } | 365 } |
| 442 | 366 |
| 443 TEST_F(PaymentRequestTest, RejectShowPromiseOnUpdateDetailsFailure) | 367 TEST_F(PaymentRequestTest, RejectShowPromiseOnUpdateDetailsFailure) |
| 444 { | 368 { |
| 445 ScriptState::Scope scope(getScriptState()); | 369 ScriptState::Scope scope(getScriptState()); |
| 446 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 370 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 447 EXPECT_FALSE(getExceptionState().hadException()); | 371 EXPECT_FALSE(getExceptionState().hadException()); |
| 448 | 372 |
| 449 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectCall(getScriptState())); | 373 request->show(getScriptState()).then(expectNoCall(), expectCall()); |
| 450 | 374 |
| 451 request->onUpdatePaymentDetailsFailure(ScriptValue::from(getScriptState(), "
oops")); | 375 request->onUpdatePaymentDetailsFailure(ScriptValue::from(getScriptState(), "
oops")); |
| 452 } | 376 } |
| 453 | 377 |
| 454 TEST_F(PaymentRequestTest, RejectCompletePromiseOnUpdateDetailsFailure) | 378 TEST_F(PaymentRequestTest, RejectCompletePromiseOnUpdateDetailsFailure) |
| 455 { | 379 { |
| 456 ScriptState::Scope scope(getScriptState()); | 380 ScriptState::Scope scope(getScriptState()); |
| 457 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 381 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 458 EXPECT_FALSE(getExceptionState().hadException()); | 382 EXPECT_FALSE(getExceptionState().hadException()); |
| 459 request->show(getScriptState()).then(MockFunction::expectCall(getScriptState
()), MockFunction::expectNoCall(getScriptState())); | 383 request->show(getScriptState()).then(expectCall(), expectNoCall()); |
| 460 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); | 384 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); |
| 461 | 385 |
| 462 request->complete(getScriptState(), true).then(MockFunction::expectNoCall(ge
tScriptState()), MockFunction::expectCall(getScriptState())); | 386 request->complete(getScriptState(), true).then(expectNoCall(), expectCall())
; |
| 463 | 387 |
| 464 request->onUpdatePaymentDetailsFailure(ScriptValue::from(getScriptState(), "
oops")); | 388 request->onUpdatePaymentDetailsFailure(ScriptValue::from(getScriptState(), "
oops")); |
| 465 } | 389 } |
| 466 | 390 |
| 467 TEST_F(PaymentRequestTest, IgnoreUpdatePaymentDetailsAfterShowPromiseResolved) | 391 TEST_F(PaymentRequestTest, IgnoreUpdatePaymentDetailsAfterShowPromiseResolved) |
| 468 { | 392 { |
| 469 ScriptState::Scope scope(getScriptState()); | 393 ScriptState::Scope scope(getScriptState()); |
| 470 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 394 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 471 EXPECT_FALSE(getExceptionState().hadException()); | 395 EXPECT_FALSE(getExceptionState().hadException()); |
| 472 request->show(getScriptState()).then(MockFunction::expectCall(getScriptState
()), MockFunction::expectNoCall(getScriptState())); | 396 request->show(getScriptState()).then(expectCall(), expectNoCall()); |
| 473 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); | 397 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse
(mojom::blink::PaymentResponse::New()); |
| 474 | 398 |
| 475 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), "foo")); | 399 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), "foo")); |
| 476 } | 400 } |
| 477 | 401 |
| 478 TEST_F(PaymentRequestTest, RejectShowPromiseOnNonPaymentDetailsUpdate) | 402 TEST_F(PaymentRequestTest, RejectShowPromiseOnNonPaymentDetailsUpdate) |
| 479 { | 403 { |
| 480 ScriptState::Scope scope(getScriptState()); | 404 ScriptState::Scope scope(getScriptState()); |
| 481 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 405 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 482 EXPECT_FALSE(getExceptionState().hadException()); | 406 EXPECT_FALSE(getExceptionState().hadException()); |
| 483 | 407 |
| 484 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectCall(getScriptState())); | 408 request->show(getScriptState()).then(expectNoCall(), expectCall()); |
| 485 | 409 |
| 486 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), "NotPaym
entDetails")); | 410 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), "NotPaym
entDetails")); |
| 487 } | 411 } |
| 488 | 412 |
| 489 TEST_F(PaymentRequestTest, RejectShowPromiseOnInvalidPaymentDetailsUpdate) | 413 TEST_F(PaymentRequestTest, RejectShowPromiseOnInvalidPaymentDetailsUpdate) |
| 490 { | 414 { |
| 491 ScriptState::Scope scope(getScriptState()); | 415 ScriptState::Scope scope(getScriptState()); |
| 492 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); | 416 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), getExceptionState()); |
| 493 EXPECT_FALSE(getExceptionState().hadException()); | 417 EXPECT_FALSE(getExceptionState().hadException()); |
| 494 | 418 |
| 495 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectCall(getScriptState())); | 419 request->show(getScriptState()).then(expectNoCall(), expectCall()); |
| 496 | 420 |
| 497 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), "{}", getExceptionState()))); | 421 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), "{}", getExceptionState()))); |
| 498 EXPECT_FALSE(getExceptionState().hadException()); | 422 EXPECT_FALSE(getExceptionState().hadException()); |
| 499 } | 423 } |
| 500 | 424 |
| 501 TEST_F(PaymentRequestTest, ClearShippingOptionOnPaymentDetailsUpdateWithoutShipp
ingOptions) | 425 TEST_F(PaymentRequestTest, ClearShippingOptionOnPaymentDetailsUpdateWithoutShipp
ingOptions) |
| 502 { | 426 { |
| 503 ScriptState::Scope scope(getScriptState()); | 427 ScriptState::Scope scope(getScriptState()); |
| 504 PaymentDetails details; | 428 PaymentDetails details; |
| 505 details.setTotal(buildPaymentItemForTest()); | 429 details.setTotal(buildPaymentItemForTest()); |
| 506 PaymentOptions options; | 430 PaymentOptions options; |
| 507 options.setRequestShipping(true); | 431 options.setRequestShipping(true); |
| 508 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), details, options, getExceptionState()); | 432 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), details, options, getExceptionState()); |
| 509 EXPECT_FALSE(getExceptionState().hadException()); | 433 EXPECT_FALSE(getExceptionState().hadException()); |
| 510 EXPECT_TRUE(request->shippingOption().isNull()); | 434 EXPECT_TRUE(request->shippingOption().isNull()); |
| 511 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectNoCall(getScriptState())); | 435 request->show(getScriptState()).then(expectNoCall(), expectNoCall()); |
| 512 String detailWithShippingOptions = "{\"total\": {\"label\": \"Total\", \"amo
unt\": {\"currency\": \"USD\", \"value\": \"5.00\"}}," | 436 String detailWithShippingOptions = "{\"total\": {\"label\": \"Total\", \"amo
unt\": {\"currency\": \"USD\", \"value\": \"5.00\"}}," |
| 513 "\"shippingOptions\": [{\"id\": \"standardShippingOption\", \"label\": \
"Standard shipping\", \"amount\": {\"currency\": \"USD\", \"value\": \"5.00\"},
\"selected\": true}]}"; | 437 "\"shippingOptions\": [{\"id\": \"standardShippingOption\", \"label\": \
"Standard shipping\", \"amount\": {\"currency\": \"USD\", \"value\": \"5.00\"},
\"selected\": true}]}"; |
| 514 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), detailWithShippingOptions, getExceptionState()))); | 438 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), detailWithShippingOptions, getExceptionState()))); |
| 515 EXPECT_FALSE(getExceptionState().hadException()); | 439 EXPECT_FALSE(getExceptionState().hadException()); |
| 516 EXPECT_EQ("standardShippingOption", request->shippingOption()); | 440 EXPECT_EQ("standardShippingOption", request->shippingOption()); |
| 517 String detailWithoutShippingOptions = "{\"total\": {\"label\": \"Total\", \"
amount\": {\"currency\": \"USD\", \"value\": \"5.00\"}}}"; | 441 String detailWithoutShippingOptions = "{\"total\": {\"label\": \"Total\", \"
amount\": {\"currency\": \"USD\", \"value\": \"5.00\"}}}"; |
| 518 | 442 |
| 519 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), detailWithoutShippingOptions, getExceptionState()))); | 443 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), detailWithoutShippingOptions, getExceptionState()))); |
| 520 | 444 |
| 521 EXPECT_FALSE(getExceptionState().hadException()); | 445 EXPECT_FALSE(getExceptionState().hadException()); |
| 522 EXPECT_TRUE(request->shippingOption().isNull()); | 446 EXPECT_TRUE(request->shippingOption().isNull()); |
| 523 } | 447 } |
| 524 | 448 |
| 525 TEST_F(PaymentRequestTest, ClearShippingOptionOnPaymentDetailsUpdateWithMultiple
UnselectedShippingOptions) | 449 TEST_F(PaymentRequestTest, ClearShippingOptionOnPaymentDetailsUpdateWithMultiple
UnselectedShippingOptions) |
| 526 { | 450 { |
| 527 ScriptState::Scope scope(getScriptState()); | 451 ScriptState::Scope scope(getScriptState()); |
| 528 PaymentOptions options; | 452 PaymentOptions options; |
| 529 options.setRequestShipping(true); | 453 options.setRequestShipping(true); |
| 530 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); | 454 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); |
| 531 EXPECT_FALSE(getExceptionState().hadException()); | 455 EXPECT_FALSE(getExceptionState().hadException()); |
| 532 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectNoCall(getScriptState())); | 456 request->show(getScriptState()).then(expectNoCall(), expectNoCall()); |
| 533 String detail = "{\"total\": {\"label\": \"Total\", \"amount\": {\"currency\
": \"USD\", \"value\": \"5.00\"}}," | 457 String detail = "{\"total\": {\"label\": \"Total\", \"amount\": {\"currency\
": \"USD\", \"value\": \"5.00\"}}," |
| 534 "\"shippingOptions\": [{\"id\": \"slow\", \"label\": \"Slow\", \"amount\
": {\"currency\": \"USD\", \"value\": \"5.00\"}}," | 458 "\"shippingOptions\": [{\"id\": \"slow\", \"label\": \"Slow\", \"amount\
": {\"currency\": \"USD\", \"value\": \"5.00\"}}," |
| 535 "{\"id\": \"fast\", \"label\": \"Fast\", \"amount\": {\"currency\": \"US
D\", \"value\": \"50.00\"}}]}"; | 459 "{\"id\": \"fast\", \"label\": \"Fast\", \"amount\": {\"currency\": \"US
D\", \"value\": \"50.00\"}}]}"; |
| 536 | 460 |
| 537 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), detail, getExceptionState()))); | 461 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), detail, getExceptionState()))); |
| 538 EXPECT_FALSE(getExceptionState().hadException()); | 462 EXPECT_FALSE(getExceptionState().hadException()); |
| 539 | 463 |
| 540 EXPECT_TRUE(request->shippingOption().isNull()); | 464 EXPECT_TRUE(request->shippingOption().isNull()); |
| 541 } | 465 } |
| 542 | 466 |
| 543 TEST_F(PaymentRequestTest, UseTheSelectedShippingOptionFromPaymentDetailsUpdate) | 467 TEST_F(PaymentRequestTest, UseTheSelectedShippingOptionFromPaymentDetailsUpdate) |
| 544 { | 468 { |
| 545 ScriptState::Scope scope(getScriptState()); | 469 ScriptState::Scope scope(getScriptState()); |
| 546 PaymentOptions options; | 470 PaymentOptions options; |
| 547 options.setRequestShipping(true); | 471 options.setRequestShipping(true); |
| 548 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); | 472 PaymentRequest* request = PaymentRequest::create(getScriptState(), buildPaym
entMethodDataForTest(), buildPaymentDetailsForTest(), options, getExceptionState
()); |
| 549 EXPECT_FALSE(getExceptionState().hadException()); | 473 EXPECT_FALSE(getExceptionState().hadException()); |
| 550 request->show(getScriptState()).then(MockFunction::expectNoCall(getScriptSta
te()), MockFunction::expectNoCall(getScriptState())); | 474 request->show(getScriptState()).then(expectNoCall(), expectNoCall()); |
| 551 String detail = "{\"total\": {\"label\": \"Total\", \"amount\": {\"currency\
": \"USD\", \"value\": \"5.00\"}}," | 475 String detail = "{\"total\": {\"label\": \"Total\", \"amount\": {\"currency\
": \"USD\", \"value\": \"5.00\"}}," |
| 552 "\"shippingOptions\": [{\"id\": \"slow\", \"label\": \"Slow\", \"amount\
": {\"currency\": \"USD\", \"value\": \"5.00\"}}," | 476 "\"shippingOptions\": [{\"id\": \"slow\", \"label\": \"Slow\", \"amount\
": {\"currency\": \"USD\", \"value\": \"5.00\"}}," |
| 553 "{\"id\": \"fast\", \"label\": \"Fast\", \"amount\": {\"currency\": \"US
D\", \"value\": \"50.00\"}, \"selected\": true}]}"; | 477 "{\"id\": \"fast\", \"label\": \"Fast\", \"amount\": {\"currency\": \"US
D\", \"value\": \"50.00\"}, \"selected\": true}]}"; |
| 554 | 478 |
| 555 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), detail, getExceptionState()))); | 479 request->onUpdatePaymentDetails(ScriptValue::from(getScriptState(), fromJSON
String(getScriptState(), detail, getExceptionState()))); |
| 556 EXPECT_FALSE(getExceptionState().hadException()); | 480 EXPECT_FALSE(getExceptionState().hadException()); |
| 557 | 481 |
| 558 EXPECT_EQ("fast", request->shippingOption()); | 482 EXPECT_EQ("fast", request->shippingOption()); |
| 559 } | 483 } |
| 560 | 484 |
| 561 } // namespace | 485 } // namespace |
| 562 } // namespace blink | 486 } // namespace blink |
| OLD | NEW |