OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |