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

Side by Side Diff: third_party/WebKit/Source/modules/payments/OnPaymentResponseTest.cpp

Issue 2250793003: Separate PaymentRequest initialization and display. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update payment-request-mock.js Created 4 years, 3 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 unified diff | Download patch
OLDNEW
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 // Tests for PaymentRequest::OnPaymentResponse(). 5 // Tests for PaymentRequest::OnPaymentResponse().
6 6
7 #include "bindings/core/v8/ScriptFunction.h" 7 #include "bindings/core/v8/ScriptFunction.h"
8 #include "bindings/core/v8/V8BindingForTesting.h" 8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "bindings/modules/v8/V8PaymentResponse.h" 9 #include "bindings/modules/v8/V8PaymentResponse.h"
10 #include "modules/payments/PaymentAddress.h" 10 #include "modules/payments/PaymentAddress.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 mojom::blink::PaymentResponsePtr response = buildPaymentResponseForTest(); 52 mojom::blink::PaymentResponsePtr response = buildPaymentResponseForTest();
53 response->shipping_option = "standardShipping"; 53 response->shipping_option = "standardShipping";
54 54
55 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall()); 55 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
56 56
57 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response)); 57 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
58 } 58 }
59 59
60 // If the merchant requests an email address, but the browser does not provide 60 // If the merchant requests an email address, but the browser does not provide
61 // it, reject the show() promise. 61 // it, reject the show() promise.
62 TEST(PaymentRequestTest, RejectMissingEmail) 62 TEST(OnPaymentResponseTest, RejectMissingEmail)
63 { 63 {
64 V8TestingScope scope; 64 V8TestingScope scope;
65 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 65 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
66 makePaymentRequestOriginSecure(scope.document()); 66 makePaymentRequestOriginSecure(scope.document());
67 PaymentOptions options; 67 PaymentOptions options;
68 options.setRequestPayerEmail(true); 68 options.setRequestPayerEmail(true);
69 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 69 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
70 EXPECT_FALSE(scope.getExceptionState().hadException()); 70 EXPECT_FALSE(scope.getExceptionState().hadException());
71 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 71 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
72 72
73 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall()); 73 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
74 74
75 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response)); 75 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
76 } 76 }
77 77
78 // If the merchant requests a phone number, but the browser does not provide it, 78 // If the merchant requests a phone number, but the browser does not provide it,
79 // reject the show() promise. 79 // reject the show() promise.
80 TEST(PaymentRequestTest, RejectMissingPhone) 80 TEST(OnPaymentResponseTest, RejectMissingPhone)
81 { 81 {
82 V8TestingScope scope; 82 V8TestingScope scope;
83 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 83 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
84 makePaymentRequestOriginSecure(scope.document()); 84 makePaymentRequestOriginSecure(scope.document());
85 PaymentOptions options; 85 PaymentOptions options;
86 options.setRequestPayerPhone(true); 86 options.setRequestPayerPhone(true);
87 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 87 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
88 EXPECT_FALSE(scope.getExceptionState().hadException()); 88 EXPECT_FALSE(scope.getExceptionState().hadException());
89 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 89 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
90 90
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 response->shipping_option = "standardShipping"; 131 response->shipping_option = "standardShipping";
132 response->shipping_address = mojom::blink::PaymentAddress::New(); 132 response->shipping_address = mojom::blink::PaymentAddress::New();
133 133
134 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall()); 134 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
135 135
136 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response)); 136 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
137 } 137 }
138 138
139 // If the merchant requests an email, but the browser provides an empty string 139 // If the merchant requests an email, but the browser provides an empty string
140 // for email, reject the show() promise. 140 // for email, reject the show() promise.
141 TEST(PaymentRequestTest, RejectEmptyEmail) 141 TEST(OnPaymentResponseTest, RejectEmptyEmail)
142 { 142 {
143 V8TestingScope scope; 143 V8TestingScope scope;
144 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 144 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
145 makePaymentRequestOriginSecure(scope.document()); 145 makePaymentRequestOriginSecure(scope.document());
146 PaymentOptions options; 146 PaymentOptions options;
147 options.setRequestPayerEmail(true); 147 options.setRequestPayerEmail(true);
148 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 148 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
149 EXPECT_FALSE(scope.getExceptionState().hadException()); 149 EXPECT_FALSE(scope.getExceptionState().hadException());
150 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 150 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
151 response->payer_email = ""; 151 response->payer_email = "";
152 152
153 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall()); 153 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
154 154
155 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response)); 155 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
156 } 156 }
157 157
158 // If the merchant requests a phone number, but the browser provides an empty 158 // If the merchant requests a phone number, but the browser provides an empty
159 // string for the phone number, reject the show() promise. 159 // string for the phone number, reject the show() promise.
160 TEST(PaymentRequestTest, RejectEmptyPhone) 160 TEST(OnPaymentResponseTest, RejectEmptyPhone)
161 { 161 {
162 V8TestingScope scope; 162 V8TestingScope scope;
163 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 163 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
164 makePaymentRequestOriginSecure(scope.document()); 164 makePaymentRequestOriginSecure(scope.document());
165 PaymentOptions options; 165 PaymentOptions options;
166 options.setRequestPayerPhone(true); 166 options.setRequestPayerPhone(true);
167 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 167 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
168 EXPECT_FALSE(scope.getExceptionState().hadException()); 168 EXPECT_FALSE(scope.getExceptionState().hadException());
169 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 169 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
170 response->payer_phone = ""; 170 response->payer_phone = "";
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 210 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
211 response->shipping_option = ""; 211 response->shipping_option = "";
212 212
213 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall()); 213 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
214 214
215 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response)); 215 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
216 } 216 }
217 217
218 // If the merchant does not request an email, but the browser provides it, 218 // If the merchant does not request an email, but the browser provides it,
219 // reject the show() promise. 219 // reject the show() promise.
220 TEST(PaymentRequestTest, RejectNotRequestedEmail) 220 TEST(OnPaymentResponseTest, RejectNotRequestedEmail)
221 { 221 {
222 V8TestingScope scope; 222 V8TestingScope scope;
223 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 223 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
224 makePaymentRequestOriginSecure(scope.document()); 224 makePaymentRequestOriginSecure(scope.document());
225 PaymentOptions options; 225 PaymentOptions options;
226 options.setRequestPayerEmail(false); 226 options.setRequestPayerEmail(false);
227 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 227 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
228 EXPECT_FALSE(scope.getExceptionState().hadException()); 228 EXPECT_FALSE(scope.getExceptionState().hadException());
229 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 229 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
230 response->payer_email = ""; 230 response->payer_email = "";
231 231
232 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall()); 232 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
233 233
234 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response)); 234 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
235 } 235 }
236 236
237 // If the merchant does not request a phone number, but the browser provides it, 237 // If the merchant does not request a phone number, but the browser provides it,
238 // reject the show() promise. 238 // reject the show() promise.
239 TEST(PaymentRequestTest, RejectNotRequestedPhone) 239 TEST(OnPaymentResponseTest, RejectNotRequestedPhone)
240 { 240 {
241 V8TestingScope scope; 241 V8TestingScope scope;
242 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 242 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
243 makePaymentRequestOriginSecure(scope.document()); 243 makePaymentRequestOriginSecure(scope.document());
244 PaymentOptions options; 244 PaymentOptions options;
245 options.setRequestPayerPhone(false); 245 options.setRequestPayerPhone(false);
246 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 246 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
247 EXPECT_FALSE(scope.getExceptionState().hadException()); 247 EXPECT_FALSE(scope.getExceptionState().hadException());
248 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 248 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
249 response->payer_phone = ""; 249 response->payer_phone = "";
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); 325 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
326 PaymentResponse* resp = V8PaymentResponse::toImplWithTypeCheck(scope.isolate (), outValue.v8Value()); 326 PaymentResponse* resp = V8PaymentResponse::toImplWithTypeCheck(scope.isolate (), outValue.v8Value());
327 EXPECT_EQ("standardShipping", resp->shippingOption()); 327 EXPECT_EQ("standardShipping", resp->shippingOption());
328 EXPECT_EQ("US", resp->shippingAddress()->country()); 328 EXPECT_EQ("US", resp->shippingAddress()->country());
329 EXPECT_EQ("en-Latn", resp->shippingAddress()->languageCode()); 329 EXPECT_EQ("en-Latn", resp->shippingAddress()->languageCode());
330 } 330 }
331 331
332 // If the merchant requests an email address, the resolved show() promise should 332 // If the merchant requests an email address, the resolved show() promise should
333 // contain an email address. 333 // contain an email address.
334 TEST(PaymentRequestTest, CanRequestEmail) 334 TEST(OnPaymentResponseTest, CanRequestEmail)
335 { 335 {
336 V8TestingScope scope; 336 V8TestingScope scope;
337 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 337 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
338 makePaymentRequestOriginSecure(scope.document()); 338 makePaymentRequestOriginSecure(scope.document());
339 PaymentOptions options; 339 PaymentOptions options;
340 options.setRequestPayerEmail(true); 340 options.setRequestPayerEmail(true);
341 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 341 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
342 EXPECT_FALSE(scope.getExceptionState().hadException()); 342 EXPECT_FALSE(scope.getExceptionState().hadException());
343 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 343 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
344 response->payer_email = "abc@gmail.com"; 344 response->payer_email = "abc@gmail.com";
345 ScriptValue outValue; 345 ScriptValue outValue;
346 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall()); 346 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall());
347 347
348 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response)); 348 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
349 349
350 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); 350 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
351 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value()); 351 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value());
352 EXPECT_EQ("abc@gmail.com", pr->payerEmail()); 352 EXPECT_EQ("abc@gmail.com", pr->payerEmail());
353 } 353 }
354 354
355 // If the merchant requests a phone number, the resolved show() promise should 355 // If the merchant requests a phone number, the resolved show() promise should
356 // contain a phone number. 356 // contain a phone number.
357 TEST(PaymentRequestTest, CanRequestPhone) 357 TEST(OnPaymentResponseTest, CanRequestPhone)
358 { 358 {
359 V8TestingScope scope; 359 V8TestingScope scope;
360 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 360 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
361 makePaymentRequestOriginSecure(scope.document()); 361 makePaymentRequestOriginSecure(scope.document());
362 PaymentOptions options; 362 PaymentOptions options;
363 options.setRequestPayerPhone(true); 363 options.setRequestPayerPhone(true);
364 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 364 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
365 EXPECT_FALSE(scope.getExceptionState().hadException()); 365 EXPECT_FALSE(scope.getExceptionState().hadException());
366 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 366 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
367 response->payer_phone = "0123"; 367 response->payer_phone = "0123";
(...skipping 25 matching lines...) Expand all
393 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (buildPaymentResponseForTest()); 393 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (buildPaymentResponseForTest());
394 394
395 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); 395 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
396 PaymentResponse* resp = V8PaymentResponse::toImplWithTypeCheck(scope.isolate (), outValue.v8Value()); 396 PaymentResponse* resp = V8PaymentResponse::toImplWithTypeCheck(scope.isolate (), outValue.v8Value());
397 EXPECT_TRUE(resp->shippingOption().isNull()); 397 EXPECT_TRUE(resp->shippingOption().isNull());
398 EXPECT_EQ(nullptr, resp->shippingAddress()); 398 EXPECT_EQ(nullptr, resp->shippingAddress());
399 } 399 }
400 400
401 // If the merchant does not request a phone number, the resolved show() promise 401 // If the merchant does not request a phone number, the resolved show() promise
402 // should contain null phone number. 402 // should contain null phone number.
403 TEST(PaymentRequestTest, PhoneNotRequred) 403 TEST(OnPaymentResponseTest, PhoneNotRequred)
404 { 404 {
405 V8TestingScope scope; 405 V8TestingScope scope;
406 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 406 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
407 makePaymentRequestOriginSecure(scope.document()); 407 makePaymentRequestOriginSecure(scope.document());
408 PaymentOptions options; 408 PaymentOptions options;
409 options.setRequestPayerPhone(false); 409 options.setRequestPayerPhone(false);
410 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 410 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
411 EXPECT_FALSE(scope.getExceptionState().hadException()); 411 EXPECT_FALSE(scope.getExceptionState().hadException());
412 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 412 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
413 response->payer_phone = String(); 413 response->payer_phone = String();
414 ScriptValue outValue; 414 ScriptValue outValue;
415 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall()); 415 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall());
416 416
417 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response)); 417 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
418 418
419 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); 419 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
420 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value()); 420 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value());
421 EXPECT_TRUE(pr->payerPhone().isNull()); 421 EXPECT_TRUE(pr->payerPhone().isNull());
422 } 422 }
423 423
424 // If the merchant does not request an email address, the resolved show() 424 // If the merchant does not request an email address, the resolved show()
425 // promise should contain null email address. 425 // promise should contain null email address.
426 TEST(PaymentRequestTest, EmailNotRequired) 426 TEST(OnPaymentResponseTest, EmailNotRequired)
427 { 427 {
428 V8TestingScope scope; 428 V8TestingScope scope;
429 PaymentRequestMockFunctionScope funcs(scope.getScriptState()); 429 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
430 makePaymentRequestOriginSecure(scope.document()); 430 makePaymentRequestOriginSecure(scope.document());
431 PaymentOptions options; 431 PaymentOptions options;
432 options.setRequestPayerEmail(false); 432 options.setRequestPayerEmail(false);
433 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState()); 433 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
434 EXPECT_FALSE(scope.getExceptionState().hadException()); 434 EXPECT_FALSE(scope.getExceptionState().hadException());
435 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew(); 435 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
436 response->payer_email = String(); 436 response->payer_email = String();
437 ScriptValue outValue; 437 ScriptValue outValue;
438 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall()); 438 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall());
439 439
440 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response)); 440 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
441 441
442 v8::MicrotasksScope::PerformCheckpoint(scope.isolate()); 442 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
443 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value()); 443 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value());
444 EXPECT_TRUE(pr->payerEmail().isNull()); 444 EXPECT_TRUE(pr->payerEmail().isNull());
445 } 445 }
446 446
447 } // namespace 447 } // namespace
448 } // namespace blink 448 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698