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

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

Issue 2073603002: Add shippingOption 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Tests for PaymentRequest::OnPaymentResponse().
6
7 #include "bindings/core/v8/ScriptFunction.h"
8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "bindings/modules/v8/V8PaymentResponse.h"
10 #include "modules/payments/PaymentAddress.h"
11 #include "modules/payments/PaymentRequest.h"
12 #include "modules/payments/PaymentTestHelper.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include <utility>
15
16 namespace blink {
17 namespace {
18
19 // If the merchant requests shipping information, but the browser does not
20 // provide the shipping option, reject the show() promise.
21 TEST(OnPaymentResponseTest, RejectMissingShippingOption)
22 {
23 V8TestingScope scope;
24 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
25 makePaymentRequestOriginSecure(scope.document());
26 PaymentOptions options;
27 options.setRequestShipping(true);
28 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
29 ASSERT_FALSE(scope.getExceptionState().hadException());
30 mojom::blink::PaymentResponsePtr response = buildPaymentResponseForTest();
31 response->shipping_address = mojom::blink::PaymentAddress::New();
32 response->shipping_address->country = "US";
33 response->shipping_address->language_code = "en";
34 response->shipping_address->script_code = "Latn";
35
36 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
37
38 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
39 }
40
41 // If the merchant requests shipping information, but the browser does not
42 // provide a shipping address, reject the show() promise.
43 TEST(OnPaymentResponseTest, RejectMissingAddress)
44 {
45 V8TestingScope scope;
46 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
47 makePaymentRequestOriginSecure(scope.document());
48 PaymentOptions options;
49 options.setRequestShipping(true);
50 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
51 ASSERT_FALSE(scope.getExceptionState().hadException());
52 mojom::blink::PaymentResponsePtr response = buildPaymentResponseForTest();
53 response->shipping_option = "standardShipping";
54
55 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
56
57 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
58 }
59
60 // If the merchant requests an email address, but the browser does not provide
61 // it, reject the show() promise.
62 TEST(PaymentRequestTest, RejectMissingEmail)
63 {
64 V8TestingScope scope;
65 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
66 makePaymentRequestOriginSecure(scope.document());
67 PaymentOptions options;
68 options.setRequestPayerEmail(true);
69 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
70 EXPECT_FALSE(scope.getExceptionState().hadException());
71 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
72 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
73
74 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
75
76 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
77 }
78
79 // If the merchant requests a phone number, but the browser does not provide it,
80 // reject the show() promise.
81 TEST(PaymentRequestTest, RejectMissingPhone)
82 {
83 V8TestingScope scope;
84 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
85 makePaymentRequestOriginSecure(scope.document());
86 PaymentOptions options;
87 options.setRequestPayerPhone(true);
88 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
89 EXPECT_FALSE(scope.getExceptionState().hadException());
90 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
91 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
92
93 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
94
95 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
96 }
97
98 // If the merchant requests shipping information, but the browser provides an
99 // empty string for shipping option, reject the show() promise.
100 TEST(OnPaymentResponseTest, RejectEmptyShippingOption)
101 {
102 V8TestingScope scope;
103 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
104 makePaymentRequestOriginSecure(scope.document());
105 PaymentOptions options;
106 options.setRequestShipping(true);
107 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
108 ASSERT_FALSE(scope.getExceptionState().hadException());
109 mojom::blink::PaymentResponsePtr response = buildPaymentResponseForTest();
110 response->shipping_option = "";
111 response->shipping_address = mojom::blink::PaymentAddress::New();
112 response->shipping_address->country = "US";
113 response->shipping_address->language_code = "en";
114 response->shipping_address->script_code = "Latn";
115
116 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
117
118 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
119 }
120
121 // If the merchant requests shipping information, but the browser provides an
122 // empty shipping address, reject the show() promise.
123 TEST(OnPaymentResponseTest, RejectEmptyAddress)
124 {
125 V8TestingScope scope;
126 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
127 makePaymentRequestOriginSecure(scope.document());
128 PaymentOptions options;
129 options.setRequestShipping(true);
130 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
131 ASSERT_FALSE(scope.getExceptionState().hadException());
132 mojom::blink::PaymentResponsePtr response = buildPaymentResponseForTest();
133 response->shipping_option = "standardShipping";
134 response->shipping_address = mojom::blink::PaymentAddress::New();
135
136 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
137
138 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
139 }
140
141 // If the merchant requests an email, but the browser provides an empty string
142 // for email, reject the show() promise.
143 TEST(PaymentRequestTest, RejectEmptyEmail)
144 {
145 V8TestingScope scope;
146 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
147 makePaymentRequestOriginSecure(scope.document());
148 PaymentOptions options;
149 options.setRequestPayerEmail(true);
150 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
151 EXPECT_FALSE(scope.getExceptionState().hadException());
152 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
153 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
154 response->payer_email = "";
155
156 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
157
158 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
159 }
160
161 // If the merchant requests a phone number, but the browser provides an empty
162 // string for the phone number, reject the show() promise.
163 TEST(PaymentRequestTest, RejectEmptyPhone)
164 {
165 V8TestingScope scope;
166 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
167 makePaymentRequestOriginSecure(scope.document());
168 PaymentOptions options;
169 options.setRequestPayerPhone(true);
170 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
171 EXPECT_FALSE(scope.getExceptionState().hadException());
172 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
173 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
174 response->payer_phone = "";
175
176 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
177
178 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
179 }
180
181 // If the merchant does not request shipping information, but the browser
182 // provides a shipping address, reject the show() promise.
183 TEST(OnPaymentResponseTest, RejectNotRequestedAddress)
184 {
185 V8TestingScope scope;
186 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
187 makePaymentRequestOriginSecure(scope.document());
188 PaymentOptions options;
189 options.setRequestShipping(false);
190 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
191 ASSERT_FALSE(scope.getExceptionState().hadException());
192 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
193 response->shipping_address = mojom::blink::PaymentAddress::New();
194 response->shipping_address->country = "US";
195 response->shipping_address->language_code = "en";
196 response->shipping_address->script_code = "Latn";
197
198 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
199
200 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
201 }
202
203 // If the merchant does not request shipping information, but the browser
204 // provides a shipping option, reject the show() promise.
205 TEST(OnPaymentResponseTest, RejectNotRequestedShippingOption)
206 {
207 V8TestingScope scope;
208 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
209 makePaymentRequestOriginSecure(scope.document());
210 PaymentOptions options;
211 options.setRequestShipping(false);
212 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
213 ASSERT_FALSE(scope.getExceptionState().hadException());
214 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
215 response->shipping_option = "";
216
217 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
218
219 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
220 }
221
222 // If the merchant does not request an email, but the browser provides it,
223 // reject the show() promise.
224 TEST(PaymentRequestTest, RejectNotRequestedEmail)
225 {
226 V8TestingScope scope;
227 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
228 makePaymentRequestOriginSecure(scope.document());
229 PaymentOptions options;
230 options.setRequestPayerEmail(false);
231 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
232 EXPECT_FALSE(scope.getExceptionState().hadException());
233 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
234 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
235 response->payer_email = "";
236
237 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
238
239 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
240 }
241
242 // If the merchant does not request a phone number, but the browser provides it,
243 // reject the show() promise.
244 TEST(PaymentRequestTest, RejectNotRequestedPhone)
245 {
246 V8TestingScope scope;
247 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
248 makePaymentRequestOriginSecure(scope.document());
249 PaymentOptions options;
250 options.setRequestPayerPhone(false);
251 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
252 EXPECT_FALSE(scope.getExceptionState().hadException());
253 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
254 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
255 response->payer_phone = "";
256
257 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
258
259 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
260 }
261
262 // If the merchant requests shipping information, but the browser provides an
263 // invalid shipping address, reject the show() promise.
264 TEST(OnPaymentResponseTest, RejectInvalidAddress)
265 {
266 V8TestingScope scope;
267 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
268 makePaymentRequestOriginSecure(scope.document());
269 PaymentOptions options;
270 options.setRequestShipping(true);
271 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
272 ASSERT_FALSE(scope.getExceptionState().hadException());
273 mojom::blink::PaymentResponsePtr response = buildPaymentResponseForTest();
274 response->shipping_option = "standardShipping";
275 response->shipping_address = mojom::blink::PaymentAddress::New();
276 response->shipping_address->country = "Atlantis";
277
278 request->show(scope.getScriptState()).then(funcs.expectNoCall(), funcs.expec tCall());
279
280 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
281 }
282
283 class PaymentResponseFunction : public ScriptFunction {
284 public:
285 static v8::Local<v8::Function> create(ScriptState* scriptState, ScriptValue* outValue)
286 {
287 PaymentResponseFunction* self = new PaymentResponseFunction(scriptState, outValue);
288 return self->bindToV8Function();
289 }
290
291 private:
292 PaymentResponseFunction(ScriptState* scriptState, ScriptValue* outValue)
293 : ScriptFunction(scriptState)
294 , m_value(outValue)
295 {
296 DCHECK(m_value);
297 }
298
299 ScriptValue call(ScriptValue value) override
300 {
301 DCHECK(!value.isEmpty());
302 *m_value = value;
303 return value;
304 }
305
306 ScriptValue* const m_value;
307 };
308
309 // If the merchant requests shipping information, the resolved show() promise
310 // should contain a shipping option and an address.
311 TEST(OnPaymentResponseTest, CanRequestShippingInformation)
312 {
313 V8TestingScope scope;
314 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
315 makePaymentRequestOriginSecure(scope.document());
316 PaymentOptions options;
317 options.setRequestShipping(true);
318 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
319 ASSERT_FALSE(scope.getExceptionState().hadException());
320 mojom::blink::PaymentResponsePtr response = buildPaymentResponseForTest();
321 response->shipping_option = "standardShipping";
322 response->shipping_address = mojom::blink::PaymentAddress::New();
323 response->shipping_address->country = "US";
324 response->shipping_address->language_code = "en";
325 response->shipping_address->script_code = "Latn";
326 ScriptValue outValue;
327 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall());
328
329 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
330
331 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
332 PaymentResponse* resp = V8PaymentResponse::toImplWithTypeCheck(scope.isolate (), outValue.v8Value());
333 EXPECT_EQ("standardShipping", resp->shippingOption());
334 EXPECT_EQ("US", resp->shippingAddress()->country());
335 EXPECT_EQ("en-Latn", resp->shippingAddress()->languageCode());
336 }
337
338 // If the merchant requests an email address, the resolved show() promise should
339 // contain an email address.
340 TEST(PaymentRequestTest, CanRequestEmail)
341 {
342 V8TestingScope scope;
343 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
344 makePaymentRequestOriginSecure(scope.document());
345 PaymentOptions options;
346 options.setRequestPayerEmail(true);
347 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
348 EXPECT_FALSE(scope.getExceptionState().hadException());
349 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
350 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
351 response->payer_email = "abc@gmail.com";
352 ScriptValue outValue;
353 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall());
354
355 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
356
357 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
358 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value());
359 EXPECT_EQ("abc@gmail.com", pr->payerEmail());
360 }
361
362 // If the merchant requests a phone number, the resolved show() promise should
363 // contain a phone number.
364 TEST(PaymentRequestTest, CanRequestPhone)
365 {
366 V8TestingScope scope;
367 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
368 makePaymentRequestOriginSecure(scope.document());
369 PaymentOptions options;
370 options.setRequestPayerPhone(true);
371 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
372 EXPECT_FALSE(scope.getExceptionState().hadException());
373 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
374 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
375 response->payer_phone = "0123";
376
377 ScriptValue outValue;
378 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall());
379
380 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
381 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
382 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value());
383
384 EXPECT_EQ("0123", pr->payerPhone());
385 }
386
387 // If the merchant does not request shipping information, the resolved show()
388 // promise should contain null shipping option and address.
389 TEST(OnPaymentResponseTest, ShippingInformationNotRequired)
390 {
391 V8TestingScope scope;
392 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
393 makePaymentRequestOriginSecure(scope.document());
394 PaymentOptions options;
395 options.setRequestShipping(false);
396 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
397 ASSERT_FALSE(scope.getExceptionState().hadException());
398 ScriptValue outValue;
399 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall());
400
401 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (buildPaymentResponseForTest());
402
403 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
404 PaymentResponse* resp = V8PaymentResponse::toImplWithTypeCheck(scope.isolate (), outValue.v8Value());
405 EXPECT_TRUE(resp->shippingOption().isNull());
406 EXPECT_EQ(nullptr, resp->shippingAddress());
407 }
408
409 // If the merchant does not request a phone number, the resolved show() promise
410 // should contain null phone number.
411 TEST(PaymentRequestTest, PhoneNotRequred)
412 {
413 V8TestingScope scope;
414 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
415 makePaymentRequestOriginSecure(scope.document());
416 PaymentOptions options;
417 options.setRequestPayerPhone(false);
418 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
419 EXPECT_FALSE(scope.getExceptionState().hadException());
420 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
421 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
422 response->payer_phone = String();
423 ScriptValue outValue;
424 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall());
425
426 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
427
428 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
429 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value());
430 EXPECT_TRUE(pr->payerPhone().isNull());
431 }
432
433 // If the merchant does not request an email address, the resolved show()
434 // promise should contain null email address.
435 TEST(PaymentRequestTest, EmailNotRequired)
436 {
437 V8TestingScope scope;
438 PaymentRequestMockFunctionScope funcs(scope.getScriptState());
439 makePaymentRequestOriginSecure(scope.document());
440 PaymentOptions options;
441 options.setRequestPayerEmail(false);
442 PaymentRequest* request = PaymentRequest::create(scope.getScriptState(), bui ldPaymentMethodDataForTest(), buildPaymentDetailsForTest(), options, scope.getEx ceptionState());
443 EXPECT_FALSE(scope.getExceptionState().hadException());
444 mojom::blink::PaymentResponsePtr response = mojom::blink::PaymentResponse::N ew();
445 response->total_amount = mojom::blink::PaymentCurrencyAmount::New();
446 response->payer_email = String();
447 ScriptValue outValue;
448 request->show(scope.getScriptState()).then(PaymentResponseFunction::create(s cope.getScriptState(), &outValue), funcs.expectNoCall());
449
450 static_cast<mojom::blink::PaymentRequestClient*>(request)->OnPaymentResponse (std::move(response));
451
452 v8::MicrotasksScope::PerformCheckpoint(scope.isolate());
453 PaymentResponse* pr = V8PaymentResponse::toImplWithTypeCheck(scope.isolate() , outValue.v8Value());
454 EXPECT_TRUE(pr->payerEmail().isNull());
455 }
456
457 } // namespace
458 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/modules.gypi ('k') | third_party/WebKit/Source/modules/payments/PaymentRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698