OLD | NEW |
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_TEST_UTIL_H_ | 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_TEST_UTIL_H_ |
6 #define COMPONENTS_DOMAIN_RELIABILITY_TEST_UTIL_H_ | 6 #define COMPONENTS_DOMAIN_RELIABILITY_TEST_UTIL_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "components/domain_reliability/config.h" | 10 #include "components/domain_reliability/config.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 public: | 41 public: |
42 typedef base::Callback<void(const std::string& report_json, | 42 typedef base::Callback<void(const std::string& report_json, |
43 const GURL& upload_url, | 43 const GURL& upload_url, |
44 const UploadCallback& upload_callback)> | 44 const UploadCallback& upload_callback)> |
45 UploadRequestCallback; | 45 UploadRequestCallback; |
46 | 46 |
47 MockUploader(const UploadRequestCallback& callback); | 47 MockUploader(const UploadRequestCallback& callback); |
48 | 48 |
49 virtual ~MockUploader(); | 49 virtual ~MockUploader(); |
50 | 50 |
| 51 virtual bool discard_uploads() const; |
| 52 |
51 // DomainReliabilityUploader implementation: | 53 // DomainReliabilityUploader implementation: |
52 virtual void UploadReport(const std::string& report_json, | 54 virtual void UploadReport(const std::string& report_json, |
53 const GURL& upload_url, | 55 const GURL& upload_url, |
54 const UploadCallback& callback) OVERRIDE; | 56 const UploadCallback& callback) OVERRIDE; |
55 | 57 |
| 58 virtual void set_discard_uploads(bool discard_uploads) OVERRIDE; |
| 59 |
56 private: | 60 private: |
57 UploadRequestCallback callback_; | 61 UploadRequestCallback callback_; |
| 62 bool discard_uploads_; |
58 }; | 63 }; |
59 | 64 |
60 class MockTime : public MockableTime { | 65 class MockTime : public MockableTime { |
61 public: | 66 public: |
62 MockTime(); | 67 MockTime(); |
63 | 68 |
64 // N.B.: Tasks (and therefore Timers) scheduled to run in the future will | 69 // N.B.: Tasks (and therefore Timers) scheduled to run in the future will |
65 // never be run if MockTime is destroyed before the mock time is advanced | 70 // never be run if MockTime is destroyed before the mock time is advanced |
66 // to their scheduled time. | 71 // to their scheduled time. |
67 virtual ~MockTime(); | 72 virtual ~MockTime(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 }; | 120 }; |
116 | 121 |
117 scoped_ptr<const DomainReliabilityConfig> MakeTestConfig(); | 122 scoped_ptr<const DomainReliabilityConfig> MakeTestConfig(); |
118 scoped_ptr<const DomainReliabilityConfig> MakeTestConfigWithDomain( | 123 scoped_ptr<const DomainReliabilityConfig> MakeTestConfigWithDomain( |
119 const std::string& domain); | 124 const std::string& domain); |
120 DomainReliabilityScheduler::Params MakeTestSchedulerParams(); | 125 DomainReliabilityScheduler::Params MakeTestSchedulerParams(); |
121 | 126 |
122 } // namespace domain_reliability | 127 } // namespace domain_reliability |
123 | 128 |
124 #endif // COMPONENTS_DOMAIN_RELIABILITY_TEST_UTIL_H_ | 129 #endif // COMPONENTS_DOMAIN_RELIABILITY_TEST_UTIL_H_ |
OLD | NEW |