Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 11506: Make the net resource interface use StringPiece instead of std::string. This... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/registry_controlled_domain.cc ('k') | webkit/tools/test_shell/test_shell_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/base/registry_controlled_domain.cc ('k') | webkit/tools/test_shell/test_shell_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698