Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: net/url_request/url_request_throttler_unittest.cc

Issue 10066045: RefCounted types should not have public destructors, net/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deprecated cookiestore fix Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #include "net/url_request/url_request_throttler_manager.h" 5 #include "net/url_request/url_request_throttler_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const TimeTicks& fake_now) 42 const TimeTicks& fake_now)
43 : net::URLRequestThrottlerEntry(manager, ""), 43 : net::URLRequestThrottlerEntry(manager, ""),
44 fake_time_now_(fake_now), 44 fake_time_now_(fake_now),
45 mock_backoff_entry_(&backoff_policy_) { 45 mock_backoff_entry_(&backoff_policy_) {
46 InitPolicy(); 46 InitPolicy();
47 47
48 mock_backoff_entry_.set_fake_now(fake_now); 48 mock_backoff_entry_.set_fake_now(fake_now);
49 set_exponential_backoff_release_time(exponential_backoff_release_time); 49 set_exponential_backoff_release_time(exponential_backoff_release_time);
50 set_sliding_window_release_time(sliding_window_release_time); 50 set_sliding_window_release_time(sliding_window_release_time);
51 } 51 }
52 virtual ~MockURLRequestThrottlerEntry() {}
53 52
54 void InitPolicy() { 53 void InitPolicy() {
55 // Some tests become flaky if we have jitter. 54 // Some tests become flaky if we have jitter.
56 backoff_policy_.jitter_factor = 0.0; 55 backoff_policy_.jitter_factor = 0.0;
57 56
58 // This lets us avoid having to make multiple failures initially (this 57 // This lets us avoid having to make multiple failures initially (this
59 // logic is already tested in the BackoffEntry unit tests). 58 // logic is already tested in the BackoffEntry unit tests).
60 backoff_policy_.num_errors_to_ignore = 0; 59 backoff_policy_.num_errors_to_ignore = 0;
61 } 60 }
62 61
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 93 }
95 94
96 void set_sliding_window_release_time( 95 void set_sliding_window_release_time(
97 const base::TimeTicks& release_time) { 96 const base::TimeTicks& release_time) {
98 URLRequestThrottlerEntry::set_sliding_window_release_time( 97 URLRequestThrottlerEntry::set_sliding_window_release_time(
99 release_time); 98 release_time);
100 } 99 }
101 100
102 TimeTicks fake_time_now_; 101 TimeTicks fake_time_now_;
103 MockBackoffEntry mock_backoff_entry_; 102 MockBackoffEntry mock_backoff_entry_;
103
104 protected:
105 virtual ~MockURLRequestThrottlerEntry() {}
104 }; 106 };
105 107
106 class MockURLRequestThrottlerManager : public URLRequestThrottlerManager { 108 class MockURLRequestThrottlerManager : public URLRequestThrottlerManager {
107 public: 109 public:
108 MockURLRequestThrottlerManager() : create_entry_index_(0) {} 110 MockURLRequestThrottlerManager() : create_entry_index_(0) {}
109 111
110 // Method to process the URL using URLRequestThrottlerManager protected 112 // Method to process the URL using URLRequestThrottlerManager protected
111 // method. 113 // method.
112 std::string DoGetUrlIdFromUrl(const GURL& url) { return GetIdFromUrl(url); } 114 std::string DoGetUrlIdFromUrl(const GURL& url) { return GetIdFromUrl(url); }
113 115
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 FAIL(); 520 FAIL();
519 } 521 }
520 522
521 scoped_refptr<net::URLRequestThrottlerEntryInterface> entry_after = 523 scoped_refptr<net::URLRequestThrottlerEntryInterface> entry_after =
522 manager.RegisterRequestUrl(GURL("http://www.example.com/")); 524 manager.RegisterRequestUrl(GURL("http://www.example.com/"));
523 EXPECT_FALSE(entry_after->ShouldRejectRequest(0)); 525 EXPECT_FALSE(entry_after->ShouldRejectRequest(0));
524 } 526 }
525 } 527 }
526 528
527 } // namespace net 529 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_throttler_simulation_unittest.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698