| 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 |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/platform_test.h" | 17 #include "base/platform_test.h" |
| 18 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 19 #include "base/string_piece.h" |
| 19 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 20 #include "net/base/load_flags.h" | 21 #include "net/base/load_flags.h" |
| 21 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 22 #include "net/base/net_module.h" | 23 #include "net/base/net_module.h" |
| 23 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
| 24 #include "net/disk_cache/disk_cache.h" | 25 #include "net/disk_cache/disk_cache.h" |
| 25 #include "net/http/http_cache.h" | 26 #include "net/http/http_cache.h" |
| 26 #include "net/http/http_network_layer.h" | 27 #include "net/http/http_network_layer.h" |
| 27 #include "net/url_request/url_request.h" | 28 #include "net/url_request/url_request.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 class TestURLRequest : public URLRequest { | 48 class TestURLRequest : public URLRequest { |
| 48 public: | 49 public: |
| 49 TestURLRequest(const GURL& url, Delegate* delegate) | 50 TestURLRequest(const GURL& url, Delegate* delegate) |
| 50 : URLRequest(url, delegate) { | 51 : URLRequest(url, delegate) { |
| 51 set_context(new URLRequestHttpCacheContext()); | 52 set_context(new URLRequestHttpCacheContext()); |
| 52 } | 53 } |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 std::string TestNetResourceProvider(int key) { | 56 StringPiece TestNetResourceProvider(int key) { |
| 56 return "header"; | 57 return "header"; |
| 57 } | 58 } |
| 58 | 59 |
| 59 // Do a case-insensitive search through |haystack| for |needle|. | 60 // Do a case-insensitive search through |haystack| for |needle|. |
| 60 bool ContainsString(const std::string& haystack, const char* needle) { | 61 bool ContainsString(const std::string& haystack, const char* needle) { |
| 61 std::string::const_iterator it = | 62 std::string::const_iterator it = |
| 62 std::search(haystack.begin(), | 63 std::search(haystack.begin(), |
| 63 haystack.end(), | 64 haystack.end(), |
| 64 needle, | 65 needle, |
| 65 needle + strlen(needle), | 66 needle + strlen(needle), |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 EXPECT_FALSE(ContainsString(data, "Content-Length:")); | 814 EXPECT_FALSE(ContainsString(data, "Content-Length:")); |
| 814 EXPECT_FALSE(ContainsString(data, "Content-Type:")); | 815 EXPECT_FALSE(ContainsString(data, "Content-Type:")); |
| 815 EXPECT_FALSE(ContainsString(data, "Origin:")); | 816 EXPECT_FALSE(ContainsString(data, "Origin:")); |
| 816 | 817 |
| 817 // These extra request headers should not have been stripped. | 818 // These extra request headers should not have been stripped. |
| 818 EXPECT_TRUE(ContainsString(data, "Accept:")); | 819 EXPECT_TRUE(ContainsString(data, "Accept:")); |
| 819 EXPECT_TRUE(ContainsString(data, "Accept-Language:")); | 820 EXPECT_TRUE(ContainsString(data, "Accept-Language:")); |
| 820 EXPECT_TRUE(ContainsString(data, "Accept-Charset:")); | 821 EXPECT_TRUE(ContainsString(data, "Accept-Charset:")); |
| 821 } | 822 } |
| 822 | 823 |
| OLD | NEW |