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 <cmath> | 15 #include <cmath> |
16 #include <limits> | 16 #include <limits> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "base/environment.h" | 19 #include "base/environment.h" |
| 20 #include "base/macros.h" |
20 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
21 #include "base/rand_util.h" | 22 #include "base/rand_util.h" |
22 #include "base/time/time.h" | 23 #include "base/time/time.h" |
23 #include "net/base/request_priority.h" | 24 #include "net/base/request_priority.h" |
24 #include "net/url_request/url_request.h" | 25 #include "net/url_request/url_request.h" |
25 #include "net/url_request/url_request_context.h" | 26 #include "net/url_request/url_request_context.h" |
26 #include "net/url_request/url_request_test_util.h" | 27 #include "net/url_request/url_request_test_util.h" |
27 #include "net/url_request/url_request_throttler_manager.h" | 28 #include "net/url_request/url_request_throttler_manager.h" |
28 #include "net/url_request/url_request_throttler_test_support.h" | 29 #include "net/url_request/url_request_throttler_test_support.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 trials[i].PrintTrialDescription(); | 738 trials[i].PrintTrialDescription(); |
738 trials[i].stats.ReportTrialResult(increase_ratio); | 739 trials[i].stats.ReportTrialResult(increase_ratio); |
739 } | 740 } |
740 | 741 |
741 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); | 742 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); |
742 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); | 743 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); |
743 } | 744 } |
744 | 745 |
745 } // namespace | 746 } // namespace |
746 } // namespace net | 747 } // namespace net |
OLD | NEW |