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

Side by Side Diff: net/http/http_response_headers_unittest.cc

Issue 12224008: Add to the list of HTTP headers that don't overwrite in 304 responses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 "Content-Length: 450\n", 915 "Content-Length: 450\n",
916 916
917 "HTTP/1/1 304 Not Modified\n" 917 "HTTP/1/1 304 Not Modified\n"
918 "connection: keep-alive\n" 918 "connection: keep-alive\n"
919 "Cache-control: max-age=10001 \n", 919 "Cache-control: max-age=10001 \n",
920 920
921 "HTTP/1.1 200 OK\n" 921 "HTTP/1.1 200 OK\n"
922 "Cache-control: max-age=10001\n" 922 "Cache-control: max-age=10001\n"
923 "Content-Length: 450\n" 923 "Content-Length: 450\n"
924 }, 924 },
925 { "HTTP/1.1 200 OK\n"
926 "X-Frame-Options: DENY\n",
927
928 "HTTP/1/1 304 Not Modified\n"
929 "X-Frame-Options: ALLOW\n",
930
931 "HTTP/1.1 200 OK\n"
932 "X-Frame-Options: DENY\n",
933 },
934 { "HTTP/1.1 200 OK\n"
935 "X-WebKit-CSP: default-src 'none'\n",
936
937 "HTTP/1/1 304 Not Modified\n"
938 "X-WebKit-CSP: default-src *\n",
939
940 "HTTP/1.1 200 OK\n"
941 "X-WebKit-CSP: default-src 'none'\n",
942 },
943 { "HTTP/1.1 200 OK\n"
944 "X-XSS-Protection: 1\n",
945
946 "HTTP/1/1 304 Not Modified\n"
947 "X-XSS-Protection: 0\n",
948
949 "HTTP/1.1 200 OK\n"
950 "X-XSS-Protection: 1\n",
951 },
952 { "HTTP/1.1 200 OK\n",
953
954 "HTTP/1/1 304 Not Modified\n"
955 "X-Content-Type-Options: nosniff\n",
956
957 "HTTP/1.1 200 OK\n"
958 },
925 }; 959 };
926 960
927 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { 961 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
928 std::string orig_headers(tests[i].orig_headers); 962 std::string orig_headers(tests[i].orig_headers);
929 HeadersToRaw(&orig_headers); 963 HeadersToRaw(&orig_headers);
930 scoped_refptr<net::HttpResponseHeaders> parsed( 964 scoped_refptr<net::HttpResponseHeaders> parsed(
931 new net::HttpResponseHeaders(orig_headers)); 965 new net::HttpResponseHeaders(orig_headers));
932 966
933 std::string new_headers(tests[i].new_headers); 967 std::string new_headers(tests[i].new_headers);
934 HeadersToRaw(&new_headers); 968 HeadersToRaw(&new_headers);
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 EXPECT_EQ(parsed->response_code(), recreated->response_code()); 1870 EXPECT_EQ(parsed->response_code(), recreated->response_code());
1837 EXPECT_EQ(parsed->GetContentLength(), recreated->GetContentLength()); 1871 EXPECT_EQ(parsed->GetContentLength(), recreated->GetContentLength());
1838 EXPECT_EQ(parsed->IsKeepAlive(), recreated->IsKeepAlive()); 1872 EXPECT_EQ(parsed->IsKeepAlive(), recreated->IsKeepAlive());
1839 1873
1840 std::string normalized_parsed; 1874 std::string normalized_parsed;
1841 parsed->GetNormalizedHeaders(&normalized_parsed); 1875 parsed->GetNormalizedHeaders(&normalized_parsed);
1842 std::string normalized_recreated; 1876 std::string normalized_recreated;
1843 parsed->GetNormalizedHeaders(&normalized_recreated); 1877 parsed->GetNormalizedHeaders(&normalized_recreated);
1844 EXPECT_EQ(normalized_parsed, normalized_recreated); 1878 EXPECT_EQ(normalized_parsed, normalized_recreated);
1845 } 1879 }
OLDNEW
« net/http/http_response_headers.cc ('K') | « net/http/http_response_headers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698