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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). | 1243 MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). |
1243 | 1244 |
1244 MessageLoop::current()->RunAllPending(); | 1245 MessageLoop::current()->RunAllPending(); |
1245 ASSERT_FALSE(file_util::PathExists(file_path_)) | 1246 ASSERT_FALSE(file_util::PathExists(file_path_)) |
1246 << file_path_.value() << " not removed."; | 1247 << file_path_.value() << " not removed."; |
1247 } | 1248 } |
1248 | 1249 |
1249 } // namespace | 1250 } // namespace |
1250 | 1251 |
1251 } // namespace net | 1252 } // namespace net |
OLD | NEW |