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