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

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: Created 3 years, 11 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 (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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 }; 708 };
709 709
710 // A mock ReportSenderInterface that just remembers the latest report 710 // A mock ReportSenderInterface that just remembers the latest report
711 // URI and report to be sent. 711 // URI and report to be sent.
712 class MockCertificateReportSender 712 class MockCertificateReportSender
713 : public TransportSecurityState::ReportSenderInterface { 713 : public TransportSecurityState::ReportSenderInterface {
714 public: 714 public:
715 MockCertificateReportSender() {} 715 MockCertificateReportSender() {}
716 ~MockCertificateReportSender() override {} 716 ~MockCertificateReportSender() override {}
717 717
718 void Send( 718 void Send(const GURL& report_uri,
Nathan Parker 2017/02/07 01:33:01 holey smokes this file is rediculously large.
719 const GURL& report_uri, 719 base::StringPiece content_type,
720 base::StringPiece content_type, 720 base::StringPiece report,
721 base::StringPiece report, 721 const base::Callback<void(int)>& success_callback,
722 const base::Callback<void()>& success_callback, 722 const base::Callback<void(const GURL&, int, int)>& error_callback)
723 const base::Callback<void(const GURL&, int)>& error_callback) override { 723 override {
724 latest_report_uri_ = report_uri; 724 latest_report_uri_ = report_uri;
725 report.CopyToString(&latest_report_); 725 report.CopyToString(&latest_report_);
726 content_type.CopyToString(&latest_content_type_); 726 content_type.CopyToString(&latest_content_type_);
727 } 727 }
728 const GURL& latest_report_uri() { return latest_report_uri_; } 728 const GURL& latest_report_uri() { return latest_report_uri_; }
729 const std::string& latest_report() { return latest_report_; } 729 const std::string& latest_report() { return latest_report_; }
730 const std::string& latest_content_type() { return latest_content_type_; } 730 const std::string& latest_content_type() { return latest_content_type_; }
731 731
732 private: 732 private:
733 GURL latest_report_uri_; 733 GURL latest_report_uri_;
(...skipping 10018 matching lines...) Expand 10 before | Expand all | Expand 10 after
10752 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 10752 AddTestInterceptor()->set_main_intercept_job(std::move(job));
10753 10753
10754 req->Start(); 10754 req->Start();
10755 req->Cancel(); 10755 req->Cancel();
10756 base::RunLoop().RunUntilIdle(); 10756 base::RunLoop().RunUntilIdle();
10757 EXPECT_EQ(ERR_ABORTED, d.request_status()); 10757 EXPECT_EQ(ERR_ABORTED, d.request_status());
10758 EXPECT_EQ(0, d.received_redirect_count()); 10758 EXPECT_EQ(0, d.received_redirect_count());
10759 } 10759 }
10760 10760
10761 } // namespace net 10761 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698