Probably broke Win7 Tests (dbg)(6). http://build.chromium.org/p/chromium.win/builders...
[chromium-blink-merge.git] / net / url_request / url_request_throttler_test_support.cc
blob9d3f4e253bc3c5c3d8e0bd32c64b940224342043
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
3 // found in the LICENSE file.
5 #include "net/url_request/url_request_throttler_test_support.h"
7 #include "net/url_request/url_request_throttler_entry.h"
9 namespace net {
11 MockBackoffEntry::MockBackoffEntry(const BackoffEntry::Policy* const policy)
12 : BackoffEntry(policy) {
15 MockBackoffEntry::~MockBackoffEntry() {
18 base::TimeTicks MockBackoffEntry::ImplGetTimeNow() const {
19 return fake_now_;
22 void MockBackoffEntry::set_fake_now(const base::TimeTicks& now) {
23 fake_now_ = now;
26 MockURLRequestThrottlerHeaderAdapter::MockURLRequestThrottlerHeaderAdapter(
27 int response_code)
28 : fake_response_code_(response_code) {
31 MockURLRequestThrottlerHeaderAdapter::MockURLRequestThrottlerHeaderAdapter(
32 const std::string& retry_value,
33 const std::string& opt_out_value,
34 int response_code)
35 : fake_retry_value_(retry_value),
36 fake_opt_out_value_(opt_out_value),
37 fake_response_code_(response_code) {
40 MockURLRequestThrottlerHeaderAdapter::~MockURLRequestThrottlerHeaderAdapter() {
43 std::string MockURLRequestThrottlerHeaderAdapter::GetNormalizedValue(
44 const std::string& key) const {
45 if (key ==
46 URLRequestThrottlerEntry::kExponentialThrottlingHeader &&
47 !fake_opt_out_value_.empty()) {
48 return fake_opt_out_value_;
51 return std::string();
54 int MockURLRequestThrottlerHeaderAdapter::GetResponseCode() const {
55 return fake_response_code_;
58 } // namespace net