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: content/browser/appcache/appcache_storage_impl_unittest.cc

Issue 1414983002: Make URLRequestTestJob accept \n terminated header lines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments mmenke Created 5 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
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 <stack> 5 #include <stack>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 GetMockResponse(request->url().path(), &headers, &body); 93 GetMockResponse(request->url().path(), &headers, &body);
94 return new net::URLRequestTestJob( 94 return new net::URLRequestTestJob(
95 request, network_delegate, headers, body, true); 95 request, network_delegate, headers, body, true);
96 } 96 }
97 97
98 private: 98 private:
99 static void GetMockResponse(const std::string& path, 99 static void GetMockResponse(const std::string& path,
100 std::string* headers, 100 std::string* headers,
101 std::string* body) { 101 std::string* body) {
102 const char manifest_headers[] = 102 const char manifest_headers[] =
103 "HTTP/1.1 200 OK\0" 103 "HTTP/1.1 200 OK\n"
104 "Content-type: text/cache-manifest\0" 104 "Content-type: text/cache-manifest\n"
105 "\0"; 105 "\n";
106 const char page_headers[] = 106 const char page_headers[] =
107 "HTTP/1.1 200 OK\0" 107 "HTTP/1.1 200 OK\n"
108 "Content-type: text/html\0" 108 "Content-type: text/html\n"
109 "\0"; 109 "\n";
110 const char not_found_headers[] = 110 const char not_found_headers[] =
111 "HTTP/1.1 404 NOT FOUND\0" 111 "HTTP/1.1 404 NOT FOUND\n"
112 "\0"; 112 "\n";
113 113
114 if (path == "/manifest") { 114 if (path == "/manifest") {
115 (*headers) = std::string(manifest_headers, arraysize(manifest_headers)); 115 (*headers) = std::string(manifest_headers, arraysize(manifest_headers));
116 (*body) = "CACHE MANIFEST\n"; 116 (*body) = "CACHE MANIFEST\n";
117 } else if (path == "/empty.html") { 117 } else if (path == "/empty.html") {
118 (*headers) = std::string(page_headers, arraysize(page_headers)); 118 (*headers) = std::string(page_headers, arraysize(page_headers));
119 (*body) = ""; 119 (*body) = "";
120 } else { 120 } else {
121 (*headers) = std::string(not_found_headers, 121 (*headers) = std::string(not_found_headers,
122 arraysize(not_found_headers)); 122 arraysize(not_found_headers));
(...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); 2020 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2);
2021 } 2021 }
2022 2022
2023 TEST_F(AppCacheStorageImplTest, Reinitialize3) { 2023 TEST_F(AppCacheStorageImplTest, Reinitialize3) {
2024 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); 2024 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3);
2025 } 2025 }
2026 2026
2027 // That's all folks! 2027 // That's all folks!
2028 2028
2029 } // namespace content 2029 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698