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

Side by Side Diff: ios/web/payments/payment_request_unittest.cc

Issue 2797833002: [Payments] base::string16 -> std::string in PaymentMethodData (Closed)
Patch Set: addressed comments Created 3 years, 8 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
« no previous file with comments | « ios/chrome/browser/payments/payment_request_util.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ios/web/public/payments/payment_request.h" 5 #include "ios/web/public/payments/payment_request.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 PaymentRequest output_request; 201 PaymentRequest output_request;
202 base::DictionaryValue request_dict; 202 base::DictionaryValue request_dict;
203 203
204 // Add the expected values to expected_request. 204 // Add the expected values to expected_request.
205 expected_request.details.total.label = base::ASCIIToUTF16("TOTAL"); 205 expected_request.details.total.label = base::ASCIIToUTF16("TOTAL");
206 expected_request.details.total.amount.currency = base::ASCIIToUTF16("GBP"); 206 expected_request.details.total.amount.currency = base::ASCIIToUTF16("GBP");
207 expected_request.details.total.amount.value = base::ASCIIToUTF16("6.66"); 207 expected_request.details.total.amount.value = base::ASCIIToUTF16("6.66");
208 expected_request.details.error = base::ASCIIToUTF16("Error in details"); 208 expected_request.details.error = base::ASCIIToUTF16("Error in details");
209 209
210 payments::PaymentMethodData method_data; 210 payments::PaymentMethodData method_data;
211 std::vector<base::string16> supported_methods; 211 std::vector<std::string> supported_methods;
212 supported_methods.push_back(base::ASCIIToUTF16("Visa")); 212 supported_methods.push_back("Visa");
213 method_data.supported_methods = supported_methods; 213 method_data.supported_methods = supported_methods;
214 expected_request.method_data.push_back(method_data); 214 expected_request.method_data.push_back(method_data);
215 215
216 // Add the same values to the dictionary to be parsed. 216 // Add the same values to the dictionary to be parsed.
217 std::unique_ptr<base::DictionaryValue> details_dict( 217 std::unique_ptr<base::DictionaryValue> details_dict(
218 new base::DictionaryValue); 218 new base::DictionaryValue);
219 std::unique_ptr<base::DictionaryValue> total_dict(new base::DictionaryValue); 219 std::unique_ptr<base::DictionaryValue> total_dict(new base::DictionaryValue);
220 total_dict->SetString("label", "TOTAL"); 220 total_dict->SetString("label", "TOTAL");
221 std::unique_ptr<base::DictionaryValue> amount_dict(new base::DictionaryValue); 221 std::unique_ptr<base::DictionaryValue> amount_dict(new base::DictionaryValue);
222 amount_dict->SetString("currency", "GBP"); 222 amount_dict->SetString("currency", "GBP");
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 EXPECT_EQ(request1, request2); 574 EXPECT_EQ(request1, request2);
575 575
576 request1.shipping_option = base::ASCIIToUTF16("2-Day"); 576 request1.shipping_option = base::ASCIIToUTF16("2-Day");
577 EXPECT_NE(request1, request2); 577 EXPECT_NE(request1, request2);
578 request2.shipping_option = base::ASCIIToUTF16("3-Day"); 578 request2.shipping_option = base::ASCIIToUTF16("3-Day");
579 EXPECT_NE(request1, request2); 579 EXPECT_NE(request1, request2);
580 request2.shipping_option = base::ASCIIToUTF16("2-Day"); 580 request2.shipping_option = base::ASCIIToUTF16("2-Day");
581 EXPECT_EQ(request1, request2); 581 EXPECT_EQ(request1, request2);
582 582
583 payments::PaymentMethodData method_datum; 583 payments::PaymentMethodData method_datum;
584 method_datum.data = base::ASCIIToUTF16("{merchantId: '123456'}"); 584 method_datum.data = "{merchantId: '123456'}";
585 std::vector<payments::PaymentMethodData> method_data1; 585 std::vector<payments::PaymentMethodData> method_data1;
586 method_data1.push_back(method_datum); 586 method_data1.push_back(method_datum);
587 request1.method_data = method_data1; 587 request1.method_data = method_data1;
588 EXPECT_NE(request1, request2); 588 EXPECT_NE(request1, request2);
589 std::vector<payments::PaymentMethodData> method_data2; 589 std::vector<payments::PaymentMethodData> method_data2;
590 request2.method_data = method_data2; 590 request2.method_data = method_data2;
591 EXPECT_NE(request1, request2); 591 EXPECT_NE(request1, request2);
592 request2.method_data = method_data1; 592 request2.method_data = method_data1;
593 EXPECT_EQ(request1, request2); 593 EXPECT_EQ(request1, request2);
594 594
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 card_response2.card_number = base::ASCIIToUTF16("8888"); 633 card_response2.card_number = base::ASCIIToUTF16("8888");
634 response1.details = card_response1; 634 response1.details = card_response1;
635 EXPECT_NE(response1, response2); 635 EXPECT_NE(response1, response2);
636 response2.details = card_response2; 636 response2.details = card_response2;
637 EXPECT_NE(response1, response2); 637 EXPECT_NE(response1, response2);
638 response2.details = card_response1; 638 response2.details = card_response1;
639 EXPECT_EQ(response1, response2); 639 EXPECT_EQ(response1, response2);
640 } 640 }
641 641
642 } // namespace web 642 } // namespace web
OLDNEW
« no previous file with comments | « ios/chrome/browser/payments/payment_request_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698