| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 return 200; | 187 return 200; |
| 188 } | 188 } |
| 189 | 189 |
| 190 int num_overloaded_ticks() const { return num_overloaded_ticks_; } | 190 int num_overloaded_ticks() const { return num_overloaded_ticks_; } |
| 191 | 191 |
| 192 int max_experienced_queries_per_tick() const { | 192 int max_experienced_queries_per_tick() const { |
| 193 return max_experienced_queries_per_tick_; | 193 return max_experienced_queries_per_tick_; |
| 194 } | 194 } |
| 195 | 195 |
| 196 const URLRequest& mock_request() const { return *mock_request_.get(); } | 196 const URLRequest& mock_request() const { return *mock_request_; } |
| 197 | 197 |
| 198 std::string VisualizeASCII(int terminal_width) { | 198 std::string VisualizeASCII(int terminal_width) { |
| 199 // Account for | characters we place at left of graph. | 199 // Account for | characters we place at left of graph. |
| 200 terminal_width -= 1; | 200 terminal_width -= 1; |
| 201 | 201 |
| 202 VerboseOut("Overloaded for %d of %d ticks.\n", num_overloaded_ticks_, | 202 VerboseOut("Overloaded for %d of %d ticks.\n", num_overloaded_ticks_, |
| 203 requests_per_tick_.size()); | 203 requests_per_tick_.size()); |
| 204 VerboseOut("Got maximum of %d requests in a tick.\n\n", | 204 VerboseOut("Got maximum of %d requests in a tick.\n\n", |
| 205 max_experienced_queries_per_tick_); | 205 max_experienced_queries_per_tick_); |
| 206 | 206 |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 trials[i].PrintTrialDescription(); | 737 trials[i].PrintTrialDescription(); |
| 738 trials[i].stats.ReportTrialResult(increase_ratio); | 738 trials[i].stats.ReportTrialResult(increase_ratio); |
| 739 } | 739 } |
| 740 | 740 |
| 741 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); | 741 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); |
| 742 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); | 742 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); |
| 743 } | 743 } |
| 744 | 744 |
| 745 } // namespace | 745 } // namespace |
| 746 } // namespace extensions | 746 } // namespace extensions |
| OLD | NEW |