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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc

Issue 437353004: Add space to Accept-Encoding header values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update SDCH test tokenization. Created 6 years, 3 months 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 | « no previous file | net/spdy/spdy_network_transaction_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 std::string m(method); 139 std::string m(method);
140 std::string trailer = 140 std::string trailer =
141 (m == "HEAD" || m == "PUT" || m == "POST") ? 141 (m == "HEAD" || m == "PUT" || m == "POST") ?
142 "Content-Length: 0\r\n" : ""; 142 "Content-Length: 0\r\n" : "";
143 143
144 std::string request1 = 144 std::string request1 =
145 base::StringPrintf("%s http://www.google.com/ HTTP/1.1\r\n" 145 base::StringPrintf("%s http://www.google.com/ HTTP/1.1\r\n"
146 "Host: www.google.com\r\n" 146 "Host: www.google.com\r\n"
147 "Proxy-Connection: keep-alive\r\n%s" 147 "Proxy-Connection: keep-alive\r\n%s"
148 "User-Agent:\r\n" 148 "User-Agent:\r\n"
149 "Accept-Encoding: gzip,deflate\r\n\r\n", 149 "Accept-Encoding: gzip, deflate\r\n\r\n",
150 method, trailer.c_str()); 150 method, trailer.c_str());
151 MockWrite data_writes[] = { 151 MockWrite data_writes[] = {
152 MockWrite(request1.c_str()), 152 MockWrite(request1.c_str()),
153 }; 153 };
154 StaticSocketDataProvider data1(data_reads, arraysize(data_reads), 154 StaticSocketDataProvider data1(data_reads, arraysize(data_reads),
155 data_writes, arraysize(data_writes)); 155 data_writes, arraysize(data_writes));
156 mock_socket_factory_.AddSocketDataProvider(&data1); 156 mock_socket_factory_.AddSocketDataProvider(&data1);
157 157
158 MockRead data_reads2[] = { 158 MockRead data_reads2[] = {
159 MockRead("HTTP/1.0 200 OK\r\n" 159 MockRead("HTTP/1.0 200 OK\r\n"
160 "Server: not-proxy\r\n\r\n"), 160 "Server: not-proxy\r\n\r\n"),
161 MockRead("content"), 161 MockRead("content"),
162 MockRead(net::SYNCHRONOUS, net::OK), 162 MockRead(net::SYNCHRONOUS, net::OK),
163 }; 163 };
164 std::string request2 = 164 std::string request2 =
165 base::StringPrintf("%s / HTTP/1.1\r\n" 165 base::StringPrintf("%s / HTTP/1.1\r\n"
166 "Host: www.google.com\r\n" 166 "Host: www.google.com\r\n"
167 "Connection: keep-alive\r\n%s" 167 "Connection: keep-alive\r\n%s"
168 "User-Agent:\r\n" 168 "User-Agent:\r\n"
169 "Accept-Encoding: gzip,deflate\r\n\r\n", 169 "Accept-Encoding: gzip, deflate\r\n\r\n",
170 method, trailer.c_str()); 170 method, trailer.c_str());
171 MockWrite data_writes2[] = { 171 MockWrite data_writes2[] = {
172 MockWrite(request2.c_str()), 172 MockWrite(request2.c_str()),
173 }; 173 };
174 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2), 174 StaticSocketDataProvider data2(data_reads2, arraysize(data_reads2),
175 data_writes2, arraysize(data_writes2)); 175 data_writes2, arraysize(data_writes2));
176 if (expected_retry) { 176 if (expected_retry) {
177 mock_socket_factory_.AddSocketDataProvider(&data2); 177 mock_socket_factory_.AddSocketDataProvider(&data2);
178 } 178 }
179 179
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 MockRead("HTTP/1.1 200 OK\r\n" 738 MockRead("HTTP/1.1 200 OK\r\n"
739 "Chrome-Proxy: bypass=0\r\n\r\n"), 739 "Chrome-Proxy: bypass=0\r\n\r\n"),
740 MockRead("Bypass message"), 740 MockRead("Bypass message"),
741 MockRead(net::SYNCHRONOUS, net::OK), 741 MockRead(net::SYNCHRONOUS, net::OK),
742 }; 742 };
743 MockWrite data_writes[] = { 743 MockWrite data_writes[] = {
744 MockWrite("GET / HTTP/1.1\r\n" 744 MockWrite("GET / HTTP/1.1\r\n"
745 "Host: www.google.com\r\n" 745 "Host: www.google.com\r\n"
746 "Connection: keep-alive\r\n" 746 "Connection: keep-alive\r\n"
747 "User-Agent:\r\n" 747 "User-Agent:\r\n"
748 "Accept-Encoding: gzip,deflate\r\n\r\n"), 748 "Accept-Encoding: gzip, deflate\r\n\r\n"),
749 }; 749 };
750 StaticSocketDataProvider data1(data_reads, arraysize(data_reads), 750 StaticSocketDataProvider data1(data_reads, arraysize(data_reads),
751 data_writes, arraysize(data_writes)); 751 data_writes, arraysize(data_writes));
752 mock_socket_factory_.AddSocketDataProvider(&data1); 752 mock_socket_factory_.AddSocketDataProvider(&data1);
753 753
754 TestDelegate d; 754 TestDelegate d;
755 scoped_ptr<URLRequest> r(context_->CreateRequest( 755 scoped_ptr<URLRequest> r(context_->CreateRequest(
756 GURL("http://www.google.com/"), 756 GURL("http://www.google.com/"),
757 net::DEFAULT_PRIORITY, 757 net::DEFAULT_PRIORITY,
758 &d, 758 &d,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 &other_proxy_info); 912 &other_proxy_info);
913 EXPECT_FALSE(other_proxy_info.is_direct()); 913 EXPECT_FALSE(other_proxy_info.is_direct());
914 914
915 OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config, 915 OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
916 empty_proxy_retry_info, &test_params, 916 empty_proxy_retry_info, &test_params,
917 &data_reduction_proxy_info); 917 &data_reduction_proxy_info);
918 EXPECT_TRUE(data_reduction_proxy_info.is_direct()); 918 EXPECT_TRUE(data_reduction_proxy_info.is_direct());
919 } 919 }
920 920
921 } // namespace data_reduction_proxy 921 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698