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 TestTickClock::TestTickClock() {}
13 TestTickClock::TestTickClock(base::TimeTicks now
) : now_ticks_(now
) {}
15 TestTickClock::~TestTickClock() {}
17 base::TimeTicks
TestTickClock::NowTicks() {
21 MockURLRequestThrottlerHeaderAdapter::MockURLRequestThrottlerHeaderAdapter(
23 : fake_response_code_(response_code
) {
26 MockURLRequestThrottlerHeaderAdapter::MockURLRequestThrottlerHeaderAdapter(
27 const std::string
& retry_value
,
28 const std::string
& opt_out_value
,
30 : fake_retry_value_(retry_value
),
31 fake_opt_out_value_(opt_out_value
),
32 fake_response_code_(response_code
) {
35 MockURLRequestThrottlerHeaderAdapter::~MockURLRequestThrottlerHeaderAdapter() {
38 std::string
MockURLRequestThrottlerHeaderAdapter::GetNormalizedValue(
39 const std::string
& key
) const {
41 URLRequestThrottlerEntry::kExponentialThrottlingHeader
&&
42 !fake_opt_out_value_
.empty()) {
43 return fake_opt_out_value_
;
49 int MockURLRequestThrottlerHeaderAdapter::GetResponseCode() const {
50 return fake_response_code_
;