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

Side by Side Diff: chrome/browser/safe_browsing/mock_permission_report_sender.h

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
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 #ifndef CHROME_BROWSER_SAFE_BROWSING_MOCK_PERMISSION_REPORT_SENDER_H_ 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_MOCK_PERMISSION_REPORT_SENDER_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_MOCK_PERMISSION_REPORT_SENDER_H_ 6 #define CHROME_BROWSER_SAFE_BROWSING_MOCK_PERMISSION_REPORT_SENDER_H_
7 7
8 #include "net/url_request/report_sender.h" 8 #include "net/url_request/report_sender.h"
9 9
10 namespace safe_browsing { 10 namespace safe_browsing {
11 11
12 // A mock ReportSender that keeps track of the last report sent and the number 12 // A mock ReportSender that keeps track of the last report sent and the number
13 // of reports sent. 13 // of reports sent.
14 class MockPermissionReportSender : public net::ReportSender { 14 class MockPermissionReportSender : public net::ReportSender {
15 public: 15 public:
16 MockPermissionReportSender(); 16 MockPermissionReportSender();
17 17
18 ~MockPermissionReportSender() override; 18 ~MockPermissionReportSender() override;
19 19
20 void Send( 20 void Send(const GURL& report_uri,
21 const GURL& report_uri, 21 base::StringPiece content_type,
22 base::StringPiece content_type, 22 base::StringPiece report,
23 base::StringPiece report, 23 const base::Callback<void()>& success_callback,
24 const base::Callback<void()>& success_callback, 24 const base::Callback<void(const GURL&, int, int)>& error_callback)
25 const base::Callback<void(const GURL&, int)>& error_callback) override; 25 override;
26 26
27 const GURL& latest_report_uri(); 27 const GURL& latest_report_uri();
28 28
29 const std::string& latest_report(); 29 const std::string& latest_report();
30 30
31 const std::string& latest_content_type(); 31 const std::string& latest_content_type();
32 32
33 int GetAndResetNumberOfReportsSent(); 33 int GetAndResetNumberOfReportsSent();
34 34
35 void WaitForReportSent(); 35 void WaitForReportSent();
36 36
37 private: 37 private:
38 GURL latest_report_uri_; 38 GURL latest_report_uri_;
39 std::string latest_report_; 39 std::string latest_report_;
40 std::string latest_content_type_; 40 std::string latest_content_type_;
41 int number_of_reports_; 41 int number_of_reports_;
42 base::Closure quit_closure_; 42 base::Closure quit_closure_;
43 43
44 void NotifyReportSentOnUIThread(); 44 void NotifyReportSentOnUIThread();
45 45
46 DISALLOW_COPY_AND_ASSIGN(MockPermissionReportSender); 46 DISALLOW_COPY_AND_ASSIGN(MockPermissionReportSender);
47 }; 47 };
48 48
49 } // namespace safe_browsing 49 } // namespace safe_browsing
50 50
51 #endif // CHROME_BROWSER_SAFE_BROWSING_MOCK_PERMISSION_REPORT_SENDER_H_ 51 #endif // CHROME_BROWSER_SAFE_BROWSING_MOCK_PERMISSION_REPORT_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698