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

Side by Side Diff: components/domain_reliability/util.h

Issue 1180223006: Domain Reliability: Simplify configs and reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix memory leak in unittests Created 5 years, 1 month 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 | « components/domain_reliability/test_util.cc ('k') | components/domain_reliability/util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_DOMAIN_RELIABILITY_UTIL_H_ 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_UTIL_H_
6 #define COMPONENTS_DOMAIN_RELIABILITY_UTIL_H_ 6 #define COMPONENTS_DOMAIN_RELIABILITY_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h"
13 #include "base/time/clock.h" 14 #include "base/time/clock.h"
14 #include "base/time/tick_clock.h" 15 #include "base/time/tick_clock.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 #include "base/tracked_objects.h" 17 #include "base/tracked_objects.h"
17 #include "components/domain_reliability/domain_reliability_export.h" 18 #include "components/domain_reliability/domain_reliability_export.h"
18 #include "components/domain_reliability/uploader.h" 19 #include "components/domain_reliability/uploader.h"
19 #include "net/http/http_response_info.h" 20 #include "net/http/http_response_info.h"
20 #include "net/url_request/url_request_status.h" 21 #include "net/url_request/url_request_status.h"
21 22
22 namespace domain_reliability { 23 namespace domain_reliability {
(...skipping 19 matching lines...) Expand all
42 int GetNetErrorFromURLRequestStatus(const net::URLRequestStatus& status); 43 int GetNetErrorFromURLRequestStatus(const net::URLRequestStatus& status);
43 44
44 // Based on the network error code, HTTP response code, and Retry-After value, 45 // Based on the network error code, HTTP response code, and Retry-After value,
45 // fills |status| with the result of a report upload. 46 // fills |status| with the result of a report upload.
46 void GetUploadResultFromResponseDetails( 47 void GetUploadResultFromResponseDetails(
47 int net_error, 48 int net_error,
48 int http_response_code, 49 int http_response_code,
49 base::TimeDelta retry_after, 50 base::TimeDelta retry_after,
50 DomainReliabilityUploader::UploadResult* result); 51 DomainReliabilityUploader::UploadResult* result);
51 52
53 GURL SanitizeURLForReport(const GURL& beacon_url,
54 const GURL& collector_url,
55 const ScopedVector<std::string>& path_prefixes);
56
52 // Mockable wrapper around TimeTicks::Now and Timer. Mock version is in 57 // Mockable wrapper around TimeTicks::Now and Timer. Mock version is in
53 // test_util.h. 58 // test_util.h.
54 // TODO(ttuttle): Rename to Time{Provider,Source,?}. 59 // TODO(ttuttle): Rename to Time{Provider,Source,?}.
55 class DOMAIN_RELIABILITY_EXPORT MockableTime : public base::Clock, 60 class DOMAIN_RELIABILITY_EXPORT MockableTime : public base::Clock,
56 public base::TickClock { 61 public base::TickClock {
57 public: 62 public:
58 // Mockable wrapper around (a subset of) base::Timer. 63 // Mockable wrapper around (a subset of) base::Timer.
59 class DOMAIN_RELIABILITY_EXPORT Timer { 64 class DOMAIN_RELIABILITY_EXPORT Timer {
60 public: 65 public:
61 virtual ~Timer(); 66 virtual ~Timer();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 102
98 // MockableTime implementation: 103 // MockableTime implementation:
99 base::Time Now() override; 104 base::Time Now() override;
100 base::TimeTicks NowTicks() override; 105 base::TimeTicks NowTicks() override;
101 scoped_ptr<MockableTime::Timer> CreateTimer() override; 106 scoped_ptr<MockableTime::Timer> CreateTimer() override;
102 }; 107 };
103 108
104 } // namespace domain_reliability 109 } // namespace domain_reliability
105 110
106 #endif // COMPONENTS_DOMAIN_RELIABILITY_UTIL_H_ 111 #endif // COMPONENTS_DOMAIN_RELIABILITY_UTIL_H_
OLDNEW
« no previous file with comments | « components/domain_reliability/test_util.cc ('k') | components/domain_reliability/util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698