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

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

Issue 1938853002: More thorough tests for PaymentRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-output-dir
Patch Set: Address comments Created 4 years, 7 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 #include "modules/payments/PaymentRequest.h" 5 #include "modules/payments/PaymentRequest.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/JSONValuesForV8.h" 8 #include "bindings/core/v8/JSONValuesForV8.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (paymentMethodSpecificKeyValue.value->getType() != JSONValue: :TypeObject) { 286 if (paymentMethodSpecificKeyValue.value->getType() != JSONValue: :TypeObject) {
287 exceptionState.throwTypeError("Data for '" + paymentMethodSp ecificKeyValue.key + "' should be a JSON-serializable object"); 287 exceptionState.throwTypeError("Data for '" + paymentMethodSp ecificKeyValue.key + "' should be a JSON-serializable object");
288 return; 288 return;
289 } 289 }
290 } 290 }
291 291
292 m_stringifiedData = jsonData->toJSONString(); 292 m_stringifiedData = jsonData->toJSONString();
293 } 293 }
294 } 294 }
295 295
296 // Set the currently selected option if only one option was passed. 296 // Set the currently selected option if only one option is passed and shippi ng is requested.
297 if (details.hasShippingOptions() && details.shippingOptions().size() == 1) 297 if (options.requestShipping() && details.hasShippingOptions() && details.shi ppingOptions().size() == 1)
298 m_shippingOption = details.shippingOptions().begin()->id(); 298 m_shippingOption = details.shippingOptions().begin()->id();
299 } 299 }
300 300
301 void PaymentRequest::contextDestroyed() 301 void PaymentRequest::contextDestroyed()
302 { 302 {
303 cleanUp(); 303 cleanUp();
304 } 304 }
305 305
306 void PaymentRequest::OnShippingAddressChange(mojom::blink::ShippingAddressPtr ad dress) 306 void PaymentRequest::OnShippingAddressChange(mojom::blink::ShippingAddressPtr ad dress)
307 { 307 {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 void PaymentRequest::cleanUp() 365 void PaymentRequest::cleanUp()
366 { 366 {
367 m_completeResolver.clear(); 367 m_completeResolver.clear();
368 m_showResolver.clear(); 368 m_showResolver.clear();
369 if (m_clientBinding.is_bound()) 369 if (m_clientBinding.is_bound())
370 m_clientBinding.Close(); 370 m_clientBinding.Close();
371 m_paymentProvider.reset(); 371 m_paymentProvider.reset();
372 } 372 }
373 373
374 } // namespace blink 374 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698