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

Side by Side Diff: net/url_request/url_request_throttler_simulation_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // The tests in this file attempt to verify the following through simulation: 5 // The tests in this file attempt to verify the following through simulation:
6 // a) That a server experiencing overload will actually benefit from the 6 // a) That a server experiencing overload will actually benefit from the
7 // anti-DDoS throttling logic, i.e. that its traffic spike will subside 7 // anti-DDoS throttling logic, i.e. that its traffic spike will subside
8 // and be distributed over a longer period of time; 8 // and be distributed over a longer period of time;
9 // b) That "well-behaved" clients of a server under DDoS attack actually 9 // b) That "well-behaved" clients of a server under DDoS attack actually
10 // benefit from the anti-DDoS throttling logic; and 10 // benefit from the anti-DDoS throttling logic; and
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 }; 292 };
293 293
294 // Mock throttler entry used by Requester class. 294 // Mock throttler entry used by Requester class.
295 class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry { 295 class MockURLRequestThrottlerEntry : public URLRequestThrottlerEntry {
296 public: 296 public:
297 explicit MockURLRequestThrottlerEntry( 297 explicit MockURLRequestThrottlerEntry(
298 URLRequestThrottlerManager* manager) 298 URLRequestThrottlerManager* manager)
299 : URLRequestThrottlerEntry(manager, ""), 299 : URLRequestThrottlerEntry(manager, ""),
300 mock_backoff_entry_(&backoff_policy_) { 300 mock_backoff_entry_(&backoff_policy_) {
301 } 301 }
302 virtual ~MockURLRequestThrottlerEntry() {}
303 302
304 virtual const BackoffEntry* GetBackoffEntry() const OVERRIDE { 303 virtual const BackoffEntry* GetBackoffEntry() const OVERRIDE {
305 return &mock_backoff_entry_; 304 return &mock_backoff_entry_;
306 } 305 }
307 306
308 virtual BackoffEntry* GetBackoffEntry() OVERRIDE { 307 virtual BackoffEntry* GetBackoffEntry() OVERRIDE {
309 return &mock_backoff_entry_; 308 return &mock_backoff_entry_;
310 } 309 }
311 310
312 virtual TimeTicks ImplGetTimeNow() const OVERRIDE { 311 virtual TimeTicks ImplGetTimeNow() const OVERRIDE {
313 return fake_now_; 312 return fake_now_;
314 } 313 }
315 314
316 void SetFakeNow(const TimeTicks& fake_time) { 315 void SetFakeNow(const TimeTicks& fake_time) {
317 fake_now_ = fake_time; 316 fake_now_ = fake_time;
318 mock_backoff_entry_.set_fake_now(fake_time); 317 mock_backoff_entry_.set_fake_now(fake_time);
319 } 318 }
320 319
321 TimeTicks fake_now() const { 320 TimeTicks fake_now() const {
322 return fake_now_; 321 return fake_now_;
323 } 322 }
324 323
324 protected:
325 virtual ~MockURLRequestThrottlerEntry() {}
326
325 private: 327 private:
326 TimeTicks fake_now_; 328 TimeTicks fake_now_;
327 MockBackoffEntry mock_backoff_entry_; 329 MockBackoffEntry mock_backoff_entry_;
328 }; 330 };
329 331
330 // Registry of results for a class of |Requester| objects (e.g. attackers vs. 332 // Registry of results for a class of |Requester| objects (e.g. attackers vs.
331 // regular clients). 333 // regular clients).
332 class RequesterResults { 334 class RequesterResults {
333 public: 335 public:
334 RequesterResults() 336 RequesterResults()
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 trials[i].PrintTrialDescription(); 745 trials[i].PrintTrialDescription();
744 trials[i].stats.ReportTrialResult(increase_ratio); 746 trials[i].stats.ReportTrialResult(increase_ratio);
745 } 747 }
746 748
747 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); 749 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio);
748 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); 750 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio);
749 } 751 }
750 752
751 } // namespace 753 } // namespace
752 } // namespace net 754 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_throttler_entry.cc ('k') | net/url_request/url_request_throttler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698