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 |
11 // c) That the approximate increase in "perceived downtime" introduced by | 11 // c) That the approximate increase in "perceived downtime" introduced by |
12 // anti-DDoS throttling for various different actual downtimes is what | 12 // anti-DDoS throttling for various different actual downtimes is what |
13 // we expect it to be. | 13 // we expect it to be. |
14 | 14 |
| 15 #include <stddef.h> |
| 16 |
15 #include <cmath> | 17 #include <cmath> |
16 #include <limits> | 18 #include <limits> |
17 #include <vector> | 19 #include <vector> |
18 | 20 |
19 #include "base/environment.h" | 21 #include "base/environment.h" |
| 22 #include "base/macros.h" |
20 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
21 #include "base/message_loop/message_loop.h" | 24 #include "base/message_loop/message_loop.h" |
22 #include "base/rand_util.h" | 25 #include "base/rand_util.h" |
23 #include "base/time/time.h" | 26 #include "base/time/time.h" |
24 #include "extensions/browser/extension_throttle_manager.h" | 27 #include "extensions/browser/extension_throttle_manager.h" |
25 #include "extensions/browser/extension_throttle_test_support.h" | 28 #include "extensions/browser/extension_throttle_test_support.h" |
26 #include "net/base/request_priority.h" | 29 #include "net/base/request_priority.h" |
27 #include "net/url_request/url_request.h" | 30 #include "net/url_request/url_request.h" |
28 #include "net/url_request/url_request_context.h" | 31 #include "net/url_request/url_request_context.h" |
29 #include "net/url_request/url_request_test_util.h" | 32 #include "net/url_request/url_request_test_util.h" |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 trials[i].PrintTrialDescription(); | 736 trials[i].PrintTrialDescription(); |
734 trials[i].stats.ReportTrialResult(increase_ratio); | 737 trials[i].stats.ReportTrialResult(increase_ratio); |
735 } | 738 } |
736 | 739 |
737 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); | 740 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); |
738 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); | 741 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); |
739 } | 742 } |
740 | 743 |
741 } // namespace | 744 } // namespace |
742 } // namespace extensions | 745 } // namespace extensions |
OLD | NEW |