Revert of Revert of Use BoringSSL in the implementation of ClearKey for Chromecast...
[chromium-blink-merge.git] / net / url_request / url_request_throttler_test_support.cc
blob5b39c047f32b4b6c608bcbd659df2c21750dd431
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 TestTickClock::TestTickClock() {}
13 TestTickClock::TestTickClock(base::TimeTicks now) : now_ticks_(now) {}
15 TestTickClock::~TestTickClock() {}
17 base::TimeTicks TestTickClock::NowTicks() {
18 return now_ticks_;
21 MockURLRequestThrottlerHeaderAdapter::MockURLRequestThrottlerHeaderAdapter(
22 int response_code)
23 : fake_response_code_(response_code) {
26 MockURLRequestThrottlerHeaderAdapter::MockURLRequestThrottlerHeaderAdapter(
27 const std::string& retry_value,
28 const std::string& opt_out_value,
29 int response_code)
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 {
40 if (key ==
41 URLRequestThrottlerEntry::kExponentialThrottlingHeader &&
42 !fake_opt_out_value_.empty()) {
43 return fake_opt_out_value_;
46 return std::string();
49 int MockURLRequestThrottlerHeaderAdapter::GetResponseCode() const {
50 return fake_response_code_;
53 } // namespace net