| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_request_unittest.h" | 5 #include "net/url_request/url_request_unittest.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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 EXPECT_TRUE(!r.is_pending()); | 388 EXPECT_TRUE(!r.is_pending()); |
| 389 EXPECT_FALSE(d.received_data_before_response()); | 389 EXPECT_FALSE(d.received_data_before_response()); |
| 390 EXPECT_EQ(d.bytes_received(), 0); | 390 EXPECT_EQ(d.bytes_received(), 0); |
| 391 } | 391 } |
| 392 #ifndef NDEBUG | 392 #ifndef NDEBUG |
| 393 DCHECK_EQ(url_request_metrics.object_count,0); | 393 DCHECK_EQ(url_request_metrics.object_count,0); |
| 394 #endif | 394 #endif |
| 395 } | 395 } |
| 396 | 396 |
| 397 TEST_F(URLRequestTest, FileTest) { | 397 TEST_F(URLRequestTest, FileTest) { |
| 398 std::wstring app_path; | 398 FilePath app_path; |
| 399 PathService::Get(base::FILE_EXE, &app_path); | 399 PathService::Get(base::FILE_EXE, &app_path); |
| 400 | 400 GURL app_url = net::FilePathToFileURL(app_path.ToWStringHack()); |
| 401 std::string app_url = WideToUTF8(app_path); | |
| 402 std::replace(app_url.begin(), app_url.end(), | |
| 403 file_util::kPathSeparator, L'/'); | |
| 404 app_url.insert(0, "file:///"); | |
| 405 | 401 |
| 406 TestDelegate d; | 402 TestDelegate d; |
| 407 { | 403 { |
| 408 TestURLRequest r(GURL(app_url), &d); | 404 TestURLRequest r(app_url, &d); |
| 409 | 405 |
| 410 r.Start(); | 406 r.Start(); |
| 411 EXPECT_TRUE(r.is_pending()); | 407 EXPECT_TRUE(r.is_pending()); |
| 412 | 408 |
| 413 MessageLoop::current()->Run(); | 409 MessageLoop::current()->Run(); |
| 414 | 410 |
| 415 int64 file_size; | 411 int64 file_size; |
| 416 file_util::GetFileSize(app_path, &file_size); | 412 file_util::GetFileSize(app_path, &file_size); |
| 417 | 413 |
| 418 EXPECT_TRUE(!r.is_pending()); | 414 EXPECT_TRUE(!r.is_pending()); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 EXPECT_FALSE(ContainsString(data, "Content-Length:")); | 827 EXPECT_FALSE(ContainsString(data, "Content-Length:")); |
| 832 EXPECT_FALSE(ContainsString(data, "Content-Type:")); | 828 EXPECT_FALSE(ContainsString(data, "Content-Type:")); |
| 833 EXPECT_FALSE(ContainsString(data, "Origin:")); | 829 EXPECT_FALSE(ContainsString(data, "Origin:")); |
| 834 | 830 |
| 835 // These extra request headers should not have been stripped. | 831 // These extra request headers should not have been stripped. |
| 836 EXPECT_TRUE(ContainsString(data, "Accept:")); | 832 EXPECT_TRUE(ContainsString(data, "Accept:")); |
| 837 EXPECT_TRUE(ContainsString(data, "Accept-Language:")); | 833 EXPECT_TRUE(ContainsString(data, "Accept-Language:")); |
| 838 EXPECT_TRUE(ContainsString(data, "Accept-Charset:")); | 834 EXPECT_TRUE(ContainsString(data, "Accept-Charset:")); |
| 839 } | 835 } |
| 840 | 836 |
| OLD | NEW |