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

Side by Side Diff: net/url_request/url_request_throttler_simulation_unittest.cc

Issue 1148603003: Remove X-Chrome-Exponential-Throttling header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 5 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
OLDNEW
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } else { 420 } else {
421 effective_delay += current_jitter; 421 effective_delay += current_jitter;
422 } 422 }
423 423
424 if (throttler_entry_->ImplGetTimeNow() - time_of_last_attempt_ > 424 if (throttler_entry_->ImplGetTimeNow() - time_of_last_attempt_ >
425 effective_delay) { 425 effective_delay) {
426 if (!throttler_entry_->ShouldRejectRequest( 426 if (!throttler_entry_->ShouldRejectRequest(
427 server_->mock_request(), 427 server_->mock_request(),
428 server_->context().network_delegate())) { 428 server_->context().network_delegate())) {
429 int status_code = server_->HandleRequest(); 429 int status_code = server_->HandleRequest();
430 MockURLRequestThrottlerHeaderAdapter response_headers(status_code); 430 throttler_entry_->UpdateWithResponse(status_code);
431 throttler_entry_->UpdateWithResponse(std::string(), &response_headers);
432 431
433 if (status_code == 200) { 432 if (status_code == 200) {
434 if (results_) 433 if (results_)
435 results_->AddSuccess(); 434 results_->AddSuccess();
436 435
437 if (last_attempt_was_failure_) { 436 if (last_attempt_was_failure_) {
438 last_downtime_duration_ = 437 last_downtime_duration_ =
439 throttler_entry_->ImplGetTimeNow() - time_of_last_success_; 438 throttler_entry_->ImplGetTimeNow() - time_of_last_success_;
440 } 439 }
441 440
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 trials[i].PrintTrialDescription(); 742 trials[i].PrintTrialDescription();
744 trials[i].stats.ReportTrialResult(increase_ratio); 743 trials[i].stats.ReportTrialResult(increase_ratio);
745 } 744 }
746 745
747 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio); 746 VerboseOut("Average increase ratio was %.4f\n", average_increase_ratio);
748 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio); 747 VerboseOut("Maximum increase ratio was %.4f\n", max_increase_ratio);
749 } 748 }
750 749
751 } // namespace 750 } // namespace
752 } // namespace net 751 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_throttler_manager.cc ('k') | net/url_request/url_request_throttler_test_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698