| 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 | 11 |
| 11 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 12 #include <windows.h> | 13 #include <windows.h> |
| 13 #include <shlobj.h> | 14 #include <shlobj.h> |
| 14 #endif | 15 #endif |
| 15 | 16 |
| 16 #include <stdint.h> | 17 #include <stdint.h> |
| 17 | 18 |
| 18 #include <algorithm> | 19 #include <algorithm> |
| (...skipping 6550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6569 #endif // !defined(DISABLE_FILE_SUPPORT) | 6570 #endif // !defined(DISABLE_FILE_SUPPORT) |
| 6570 | 6571 |
| 6571 TEST_F(URLRequestTestHTTP, RestrictDataRedirects) { | 6572 TEST_F(URLRequestTestHTTP, RestrictDataRedirects) { |
| 6572 ASSERT_TRUE(http_test_server()->Start()); | 6573 ASSERT_TRUE(http_test_server()->Start()); |
| 6573 | 6574 |
| 6574 TestDelegate d; | 6575 TestDelegate d; |
| 6575 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( | 6576 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( |
| 6576 http_test_server()->GetURL("/redirect-to-data.html"), DEFAULT_PRIORITY, | 6577 http_test_server()->GetURL("/redirect-to-data.html"), DEFAULT_PRIORITY, |
| 6577 &d)); | 6578 &d)); |
| 6578 req->Start(); | 6579 req->Start(); |
| 6579 base::MessageLoop::current()->Run(); | 6580 base::RunLoop().Run(); |
| 6580 | 6581 |
| 6581 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status()); | 6582 EXPECT_EQ(URLRequestStatus::FAILED, req->status().status()); |
| 6582 EXPECT_EQ(ERR_UNSAFE_REDIRECT, req->status().error()); | 6583 EXPECT_EQ(ERR_UNSAFE_REDIRECT, req->status().error()); |
| 6583 } | 6584 } |
| 6584 | 6585 |
| 6585 TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) { | 6586 TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) { |
| 6586 ASSERT_TRUE(http_test_server()->Start()); | 6587 ASSERT_TRUE(http_test_server()->Start()); |
| 6587 | 6588 |
| 6588 TestDelegate d; | 6589 TestDelegate d; |
| 6589 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( | 6590 std::unique_ptr<URLRequest> req(default_context_.CreateRequest( |
| (...skipping 3557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10147 AddTestInterceptor()->set_main_intercept_job(std::move(job)); | 10148 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
| 10148 | 10149 |
| 10149 req->Start(); | 10150 req->Start(); |
| 10150 req->Cancel(); | 10151 req->Cancel(); |
| 10151 base::RunLoop().RunUntilIdle(); | 10152 base::RunLoop().RunUntilIdle(); |
| 10152 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); | 10153 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); |
| 10153 EXPECT_EQ(0, d.received_redirect_count()); | 10154 EXPECT_EQ(0, d.received_redirect_count()); |
| 10154 } | 10155 } |
| 10155 | 10156 |
| 10156 } // namespace net | 10157 } // namespace net |
| OLD | NEW |