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

Side by Side Diff: components/autofill/content/browser/wallet/wallet_client_unittest.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/json/json_reader.h" 5 #include "base/json/json_reader.h"
6 #include "base/json/json_writer.h" 6 #include "base/json/json_writer.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 869
870 // If this is not a JSON dictionary, return plain text. 870 // If this is not a JSON dictionary, return plain text.
871 if (!root || !root->IsType(base::Value::TYPE_DICTIONARY)) 871 if (!root || !root->IsType(base::Value::TYPE_DICTIONARY))
872 return upload_data; 872 return upload_data;
873 873
874 // Remove api_key entry (to prevent accidental leak), return JSON as text. 874 // Remove api_key entry (to prevent accidental leak), return JSON as text.
875 base::DictionaryValue* dict = 875 base::DictionaryValue* dict =
876 static_cast<base::DictionaryValue*>(root.get()); 876 static_cast<base::DictionaryValue*>(root.get());
877 dict->Remove("api_key", NULL); 877 dict->Remove("api_key", NULL);
878 std::string clean_upload_data; 878 std::string clean_upload_data;
879 base::JSONWriter::Write(dict, &clean_upload_data); 879 base::JSONWriter::Write(*dict, &clean_upload_data);
880 return clean_upload_data; 880 return clean_upload_data;
881 } 881 }
882 882
883 net::TestURLFetcherFactory factory_; 883 net::TestURLFetcherFactory factory_;
884 }; 884 };
885 885
886 TEST_F(WalletClientTest, WalletErrorCodes) { 886 TEST_F(WalletClientTest, WalletErrorCodes) {
887 struct { 887 struct {
888 std::string error_type_string; 888 std::string error_type_string;
889 std::string message_type_for_buyer_string; 889 std::string message_type_for_buyer_string;
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 EXPECT_TRUE(wallet_client_->HasRequestInProgress()); 1894 EXPECT_TRUE(wallet_client_->HasRequestInProgress());
1895 wallet_client_->CancelRequest(); 1895 wallet_client_->CancelRequest();
1896 EXPECT_FALSE(wallet_client_->HasRequestInProgress()); 1896 EXPECT_FALSE(wallet_client_->HasRequestInProgress());
1897 1897
1898 ExpectBaselineMetrics(histogram); 1898 ExpectBaselineMetrics(histogram);
1899 histogram.ExpectTotalCount("Wallet.ApiCallDuration.GetWalletItems", 0); 1899 histogram.ExpectTotalCount("Wallet.ApiCallDuration.GetWalletItems", 0);
1900 } 1900 }
1901 1901
1902 } // namespace wallet 1902 } // namespace wallet
1903 } // namespace autofill 1903 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698