| OLD | NEW |
| 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 // 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 virtual ~MockURLRequestThrottlerEntry() {} | 325 virtual ~MockURLRequestThrottlerEntry() {} |
| 326 | 326 |
| 327 private: | 327 private: |
| 328 TimeTicks fake_now_; | 328 TimeTicks fake_now_; |
| 329 MockBackoffEntry mock_backoff_entry_; | 329 MockBackoffEntry mock_backoff_entry_; |
| 330 }; | 330 }; |
| 331 | 331 |
| 332 // 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. |
| 333 // regular clients). | 333 // regular clients). |
| 334 class RequesterResults { | 334 class RequesterResults { |
| 335 public: | 335 public: |
| 336 RequesterResults() | 336 RequesterResults() |
| 337 : num_attempts_(0), num_successful_(0), num_failed_(0), num_blocked_(0) { | 337 : num_attempts_(0), num_successful_(0), num_failed_(0), num_blocked_(0) { |
| 338 } | 338 } |
| 339 | 339 |
| 340 void AddSuccess() { | 340 void AddSuccess() { |
| 341 ++num_attempts_; | 341 ++num_attempts_; |
| 342 ++num_successful_; | 342 ++num_successful_; |
| 343 } | 343 } |
| 344 | 344 |
| 345 void AddFailure() { | 345 void AddFailure() { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 trials[i].PrintTrialDescription(); | 745 trials[i].PrintTrialDescription(); |
| 746 trials[i].stats.ReportTrialResult(increase_ratio); | 746 trials[i].stats.ReportTrialResult(increase_ratio); |
| 747 } | 747 } |
| 748 | 748 |
| 749 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); | 749 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); |
| 750 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); | 750 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); |
| 751 } | 751 } |
| 752 | 752 |
| 753 } // namespace | 753 } // namespace |
| 754 } // namespace net | 754 } // namespace net |
| OLD | NEW |