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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 GURL("invalid url"), DEFAULT_PRIORITY, &d, NULL)); | 1014 GURL("invalid url"), DEFAULT_PRIORITY, &d, NULL)); |
1015 | 1015 |
1016 r->Start(); | 1016 r->Start(); |
1017 EXPECT_TRUE(r->is_pending()); | 1017 EXPECT_TRUE(r->is_pending()); |
1018 | 1018 |
1019 base::RunLoop().Run(); | 1019 base::RunLoop().Run(); |
1020 EXPECT_TRUE(d.request_failed()); | 1020 EXPECT_TRUE(d.request_failed()); |
1021 } | 1021 } |
1022 } | 1022 } |
1023 | 1023 |
| 1024 TEST_F(URLRequestTest, InvalidReferrerTest) { |
| 1025 TestURLRequestContext context; |
| 1026 TestNetworkDelegate network_delegate; |
| 1027 network_delegate.set_cancel_request_with_policy_violating_referrer(true); |
| 1028 context.set_network_delegate(&network_delegate); |
| 1029 TestDelegate d; |
| 1030 scoped_ptr<URLRequest> req(context.CreateRequest( |
| 1031 GURL("http://localhost/"), DEFAULT_PRIORITY, &d, NULL)); |
| 1032 req->SetReferrer("https://somewhere.com/"); |
| 1033 |
| 1034 req->Start(); |
| 1035 base::RunLoop().Run(); |
| 1036 EXPECT_TRUE(d.request_failed()); |
| 1037 } |
| 1038 |
1024 #if defined(OS_WIN) | 1039 #if defined(OS_WIN) |
1025 TEST_F(URLRequestTest, ResolveShortcutTest) { | 1040 TEST_F(URLRequestTest, ResolveShortcutTest) { |
1026 base::FilePath app_path; | 1041 base::FilePath app_path; |
1027 PathService::Get(base::DIR_SOURCE_ROOT, &app_path); | 1042 PathService::Get(base::DIR_SOURCE_ROOT, &app_path); |
1028 app_path = app_path.AppendASCII("net"); | 1043 app_path = app_path.AppendASCII("net"); |
1029 app_path = app_path.AppendASCII("data"); | 1044 app_path = app_path.AppendASCII("data"); |
1030 app_path = app_path.AppendASCII("url_request_unittest"); | 1045 app_path = app_path.AppendASCII("url_request_unittest"); |
1031 app_path = app_path.AppendASCII("with-headers.html"); | 1046 app_path = app_path.AppendASCII("with-headers.html"); |
1032 | 1047 |
1033 std::wstring lnk_path = app_path.value() + L".lnk"; | 1048 std::wstring lnk_path = app_path.value() + L".lnk"; |
(...skipping 7129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8163 | 8178 |
8164 EXPECT_FALSE(r->is_pending()); | 8179 EXPECT_FALSE(r->is_pending()); |
8165 EXPECT_EQ(1, d->response_started_count()); | 8180 EXPECT_EQ(1, d->response_started_count()); |
8166 EXPECT_FALSE(d->received_data_before_response()); | 8181 EXPECT_FALSE(d->received_data_before_response()); |
8167 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); | 8182 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); |
8168 } | 8183 } |
8169 } | 8184 } |
8170 #endif // !defined(DISABLE_FTP_SUPPORT) | 8185 #endif // !defined(DISABLE_FTP_SUPPORT) |
8171 | 8186 |
8172 } // namespace net | 8187 } // namespace net |
OLD | NEW |