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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 2648713002: Add response code to the success callback of ReportSender (Closed)
Patch Set: eroman and estark comments Created 3 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
« no previous file with comments | « net/url_request/report_sender_unittest.cc ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 }; 716 };
717 717
718 // A mock ReportSenderInterface that just remembers the latest report 718 // A mock ReportSenderInterface that just remembers the latest report
719 // URI and report to be sent. 719 // URI and report to be sent.
720 class MockCertificateReportSender 720 class MockCertificateReportSender
721 : public TransportSecurityState::ReportSenderInterface { 721 : public TransportSecurityState::ReportSenderInterface {
722 public: 722 public:
723 MockCertificateReportSender() {} 723 MockCertificateReportSender() {}
724 ~MockCertificateReportSender() override {} 724 ~MockCertificateReportSender() override {}
725 725
726 void Send( 726 void Send(const GURL& report_uri,
727 const GURL& report_uri, 727 base::StringPiece content_type,
728 base::StringPiece content_type, 728 base::StringPiece report,
729 base::StringPiece report, 729 const base::Callback<void()>& success_callback,
730 const base::Callback<void()>& success_callback, 730 const base::Callback<void(const GURL&, int, int)>& error_callback)
731 const base::Callback<void(const GURL&, int)>& error_callback) override { 731 override {
732 latest_report_uri_ = report_uri; 732 latest_report_uri_ = report_uri;
733 report.CopyToString(&latest_report_); 733 report.CopyToString(&latest_report_);
734 content_type.CopyToString(&latest_content_type_); 734 content_type.CopyToString(&latest_content_type_);
735 } 735 }
736 const GURL& latest_report_uri() { return latest_report_uri_; } 736 const GURL& latest_report_uri() { return latest_report_uri_; }
737 const std::string& latest_report() { return latest_report_; } 737 const std::string& latest_report() { return latest_report_; }
738 const std::string& latest_content_type() { return latest_content_type_; } 738 const std::string& latest_content_type() { return latest_content_type_; }
739 739
740 private: 740 private:
741 GURL latest_report_uri_; 741 GURL latest_report_uri_;
(...skipping 10186 matching lines...) Expand 10 before | Expand all | Expand 10 after
10928 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 10928 AddTestInterceptor()->set_main_intercept_job(std::move(job));
10929 10929
10930 req->Start(); 10930 req->Start();
10931 req->Cancel(); 10931 req->Cancel();
10932 base::RunLoop().RunUntilIdle(); 10932 base::RunLoop().RunUntilIdle();
10933 EXPECT_EQ(ERR_ABORTED, d.request_status()); 10933 EXPECT_EQ(ERR_ABORTED, d.request_status());
10934 EXPECT_EQ(0, d.received_redirect_count()); 10934 EXPECT_EQ(0, d.received_redirect_count());
10935 } 10935 }
10936 10936
10937 } // namespace net 10937 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/report_sender_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698