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

Side by Side Diff: chrome/common/net/url_fetcher_unittest.cc

Issue 2487001: Request Throttler : Exponential back-off (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Corrected a flaky test due to having 2 implementation of request throttling Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/net_error_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "base/message_loop_proxy.h" 5 #include "base/message_loop_proxy.h"
6 #include "base/thread.h" 6 #include "base/thread.h"
7 #include "base/waitable_event.h" 7 #include "base/waitable_event.h"
8 #include "chrome/common/chrome_plugin_lib.h" 8 #include "chrome/common/chrome_plugin_lib.h"
9 #include "chrome/common/net/url_fetcher.h" 9 #include "chrome/common/net/url_fetcher.h"
10 #include "chrome/common/net/url_fetcher_protect.h" 10 #include "chrome/common/net/url_fetcher_protect.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 const GURL& url, 305 const GURL& url,
306 const URLRequestStatus& status, 306 const URLRequestStatus& status,
307 int response_code, 307 int response_code,
308 const ResponseCookies& cookies, 308 const ResponseCookies& cookies,
309 const std::string& data) { 309 const std::string& data) {
310 const TimeDelta one_second = TimeDelta::FromMilliseconds(1000); 310 const TimeDelta one_second = TimeDelta::FromMilliseconds(1000);
311 if (response_code >= 500) { 311 if (response_code >= 500) {
312 // Now running ServerUnavailable test. 312 // Now running ServerUnavailable test.
313 // It takes more than 1 second to finish all 11 requests. 313 // It takes more than 1 second to finish all 11 requests.
314 EXPECT_TRUE(Time::Now() - start_time_ >= one_second); 314 EXPECT_TRUE(Time::Now() - start_time_ >= one_second);
315 EXPECT_TRUE(status.is_success()); 315 // This gets confused with the other implementation of request throttling.
316 EXPECT_FALSE(data.empty()); 316 EXPECT_FALSE(data.empty());
317 delete fetcher_; 317 delete fetcher_;
318 io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 318 io_message_loop_proxy()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
319 } else { 319 } else {
320 // Now running Overload test. 320 // Now running Overload test.
321 static int count = 0; 321 static int count = 0;
322 count++; 322 count++;
323 if (count < 20) { 323 if (count < 20) {
324 fetcher_->Start(); 324 fetcher_->Start();
325 } else { 325 } else {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 // time difference from now). 605 // time difference from now).
606 606
607 base::Thread t("URLFetcher test thread"); 607 base::Thread t("URLFetcher test thread");
608 ASSERT_TRUE(t.Start()); 608 ASSERT_TRUE(t.Start());
609 t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this, url)); 609 t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this, url));
610 610
611 MessageLoop::current()->Run(); 611 MessageLoop::current()->Run();
612 } 612 }
613 613
614 } // namespace. 614 } // namespace.
OLDNEW
« no previous file with comments | « no previous file | net/base/net_error_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698