OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return "header"; | 62 return "header"; |
63 } | 63 } |
64 | 64 |
65 // Do a case-insensitive search through |haystack| for |needle|. | 65 // Do a case-insensitive search through |haystack| for |needle|. |
66 bool ContainsString(const std::string& haystack, const char* needle) { | 66 bool ContainsString(const std::string& haystack, const char* needle) { |
67 std::string::const_iterator it = | 67 std::string::const_iterator it = |
68 std::search(haystack.begin(), | 68 std::search(haystack.begin(), |
69 haystack.end(), | 69 haystack.end(), |
70 needle, | 70 needle, |
71 needle + strlen(needle), | 71 needle + strlen(needle), |
72 CaseInsensitiveCompare<char>()); | 72 base::CaseInsensitiveCompare<char>()); |
73 return it != haystack.end(); | 73 return it != haystack.end(); |
74 } | 74 } |
75 | 75 |
76 void FillBuffer(char* buffer, size_t len) { | 76 void FillBuffer(char* buffer, size_t len) { |
77 static bool called = false; | 77 static bool called = false; |
78 if (!called) { | 78 if (!called) { |
79 called = true; | 79 called = true; |
80 int seed = static_cast<int>(Time::Now().ToInternalValue()); | 80 int seed = static_cast<int>(Time::Now().ToInternalValue()); |
81 srand(seed); | 81 srand(seed); |
82 } | 82 } |
(...skipping 2548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2631 TestURLRequest | 2631 TestURLRequest |
2632 req(test_server_.GetURL("echoheaderoverride?Accept-Charset"), &d); | 2632 req(test_server_.GetURL("echoheaderoverride?Accept-Charset"), &d); |
2633 req.set_context(new TestURLRequestContext()); | 2633 req.set_context(new TestURLRequestContext()); |
2634 net::HttpRequestHeaders headers; | 2634 net::HttpRequestHeaders headers; |
2635 headers.SetHeader(net::HttpRequestHeaders::kAcceptCharset, "koi-8r"); | 2635 headers.SetHeader(net::HttpRequestHeaders::kAcceptCharset, "koi-8r"); |
2636 req.SetExtraRequestHeaders(headers); | 2636 req.SetExtraRequestHeaders(headers); |
2637 req.Start(); | 2637 req.Start(); |
2638 MessageLoop::current()->Run(); | 2638 MessageLoop::current()->Run(); |
2639 EXPECT_EQ(std::string("koi-8r"), d.data_received()); | 2639 EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
2640 } | 2640 } |
OLD | NEW |