| 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 #include "net/url_request/url_fetcher_impl.h" | 5 #include "net/url_request/url_fetcher_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 io_message_loop_proxy(), request_context())); | 545 io_message_loop_proxy(), request_context())); |
| 546 fetcher_->SetStopOnRedirect(true); | 546 fetcher_->SetStopOnRedirect(true); |
| 547 fetcher_->Start(); | 547 fetcher_->Start(); |
| 548 } | 548 } |
| 549 | 549 |
| 550 void URLFetcherStopOnRedirectTest::OnURLFetchComplete( | 550 void URLFetcherStopOnRedirectTest::OnURLFetchComplete( |
| 551 const URLFetcher* source) { | 551 const URLFetcher* source) { |
| 552 callback_called_ = true; | 552 callback_called_ = true; |
| 553 EXPECT_EQ(GURL(kRedirectTarget), source->GetURL()); | 553 EXPECT_EQ(GURL(kRedirectTarget), source->GetURL()); |
| 554 EXPECT_EQ(URLRequestStatus::CANCELED, source->GetStatus().status()); | 554 EXPECT_EQ(URLRequestStatus::CANCELED, source->GetStatus().status()); |
| 555 EXPECT_EQ(ERR_ABORTED, source->GetStatus().error()); |
| 555 EXPECT_EQ(301, source->GetResponseCode()); | 556 EXPECT_EQ(301, source->GetResponseCode()); |
| 556 CleanupAfterFetchComplete(); | 557 CleanupAfterFetchComplete(); |
| 557 } | 558 } |
| 558 | 559 |
| 559 void URLFetcherProtectTest::CreateFetcher(const GURL& url) { | 560 void URLFetcherProtectTest::CreateFetcher(const GURL& url) { |
| 560 fetcher_ = new URLFetcherImpl(url, URLFetcher::GET, this); | 561 fetcher_ = new URLFetcherImpl(url, URLFetcher::GET, this); |
| 561 fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter( | 562 fetcher_->SetRequestContext(new ThrottlingTestURLRequestContextGetter( |
| 562 io_message_loop_proxy(), request_context())); | 563 io_message_loop_proxy(), request_context())); |
| 563 start_time_ = Time::Now(); | 564 start_time_ = Time::Now(); |
| 564 fetcher_->SetMaxRetries(11); | 565 fetcher_->SetMaxRetries(11); |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). | 1245 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). |
| 1245 | 1246 |
| 1246 MessageLoop::current()->RunAllPending(); | 1247 MessageLoop::current()->RunAllPending(); |
| 1247 ASSERT_FALSE(file_util::PathExists(file_path_)) | 1248 ASSERT_FALSE(file_util::PathExists(file_path_)) |
| 1248 << file_path_.value() << " not removed."; | 1249 << file_path_.value() << " not removed."; |
| 1249 } | 1250 } |
| 1250 | 1251 |
| 1251 } // namespace | 1252 } // namespace |
| 1252 | 1253 |
| 1253 } // namespace net | 1254 } // namespace net |
| OLD | NEW |