| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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. |
| OLD | NEW |