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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #endif | 10 #endif |
(...skipping 5417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5428 req->Start(); | 5428 req->Start(); |
5429 base::RunLoop().Run(); | 5429 base::RunLoop().Run(); |
5430 | 5430 |
5431 EXPECT_EQ(URLRequestStatus::SUCCESS, req->status().status()); | 5431 EXPECT_EQ(URLRequestStatus::SUCCESS, req->status().status()); |
5432 EXPECT_FALSE(req->was_cached()); | 5432 EXPECT_FALSE(req->was_cached()); |
5433 EXPECT_EQ(0, d.received_redirect_count()); | 5433 EXPECT_EQ(0, d.received_redirect_count()); |
5434 EXPECT_EQ(initial_url, req->url()); | 5434 EXPECT_EQ(initial_url, req->url()); |
5435 } | 5435 } |
5436 } | 5436 } |
5437 | 5437 |
5438 // Make sure an HTTP request using the "unsafe" port 443 fails. | |
5439 // See: https://crbug.com/436451 | |
5440 TEST_F(URLRequestTestHTTP, UnsafePort) { | |
5441 TestDelegate d; | |
5442 { | |
5443 scoped_ptr<URLRequest> r(default_context_.CreateRequest( | |
5444 GURL("http://www.google.com:443/"), DEFAULT_PRIORITY, &d, NULL)); | |
5445 | |
5446 r->Start(); | |
5447 EXPECT_TRUE(r->is_pending()); | |
5448 | |
5449 base::RunLoop().Run(); | |
5450 | |
5451 EXPECT_FALSE(r->is_pending()); | |
5452 EXPECT_EQ(URLRequestStatus::FAILED, r->status().status()); | |
5453 EXPECT_EQ(ERR_UNSAFE_PORT, r->status().error()); | |
5454 } | |
5455 } | |
5456 | |
5457 // Tests that redirection to an unsafe URL is allowed when it has been marked as | 5438 // Tests that redirection to an unsafe URL is allowed when it has been marked as |
5458 // safe. | 5439 // safe. |
5459 TEST_F(URLRequestTestHTTP, UnsafeRedirectToWhitelistedUnsafeURL) { | 5440 TEST_F(URLRequestTestHTTP, UnsafeRedirectToWhitelistedUnsafeURL) { |
5460 ASSERT_TRUE(test_server_.Start()); | 5441 ASSERT_TRUE(test_server_.Start()); |
5461 | 5442 |
5462 GURL unsafe_url("data:text/html,this-is-considered-an-unsafe-url"); | 5443 GURL unsafe_url("data:text/html,this-is-considered-an-unsafe-url"); |
5463 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url); | 5444 default_network_delegate_.set_redirect_on_headers_received_url(unsafe_url); |
5464 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url); | 5445 default_network_delegate_.set_allowed_unsafe_redirect_url(unsafe_url); |
5465 | 5446 |
5466 TestDelegate d; | 5447 TestDelegate d; |
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8834 | 8815 |
8835 EXPECT_FALSE(r->is_pending()); | 8816 EXPECT_FALSE(r->is_pending()); |
8836 EXPECT_EQ(1, d->response_started_count()); | 8817 EXPECT_EQ(1, d->response_started_count()); |
8837 EXPECT_FALSE(d->received_data_before_response()); | 8818 EXPECT_FALSE(d->received_data_before_response()); |
8838 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 8819 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
8839 } | 8820 } |
8840 } | 8821 } |
8841 #endif // !defined(DISABLE_FTP_SUPPORT) | 8822 #endif // !defined(DISABLE_FTP_SUPPORT) |
8842 | 8823 |
8843 } // namespace net | 8824 } // namespace net |
OLD | NEW |