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"
11 MockBackoffEntry::MockBackoffEntry(const BackoffEntry::Policy
* const policy
)
12 : BackoffEntry(policy
) {
15 MockBackoffEntry::~MockBackoffEntry() {
18 base::TimeTicks
MockBackoffEntry::ImplGetTimeNow() const {
22 void MockBackoffEntry::set_fake_now(const base::TimeTicks
& now
) {
26 MockURLRequestThrottlerHeaderAdapter::MockURLRequestThrottlerHeaderAdapter(
28 : fake_response_code_(response_code
) {
31 MockURLRequestThrottlerHeaderAdapter::MockURLRequestThrottlerHeaderAdapter(
32 const std::string
& retry_value
,
33 const std::string
& opt_out_value
,
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 {
46 URLRequestThrottlerEntry::kExponentialThrottlingHeader
&&
47 !fake_opt_out_value_
.empty()) {
48 return fake_opt_out_value_
;
54 int MockURLRequestThrottlerHeaderAdapter::GetResponseCode() const {
55 return fake_response_code_
;