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

Side by Side Diff: content/browser/service_worker/service_worker_browsertest.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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 public: 228 public:
229 LongLivedResourceInterceptor(const std::string& body) 229 LongLivedResourceInterceptor(const std::string& body)
230 : body_(body) {} 230 : body_(body) {}
231 ~LongLivedResourceInterceptor() override {} 231 ~LongLivedResourceInterceptor() override {}
232 232
233 // net::URLRequestInterceptor implementation 233 // net::URLRequestInterceptor implementation
234 net::URLRequestJob* MaybeInterceptRequest( 234 net::URLRequestJob* MaybeInterceptRequest(
235 net::URLRequest* request, 235 net::URLRequest* request,
236 net::NetworkDelegate* network_delegate) const override { 236 net::NetworkDelegate* network_delegate) const override {
237 const char kHeaders[] = 237 const char kHeaders[] =
238 "HTTP/1.1 200 OK\0" 238 "HTTP/1.1 200 OK\n"
239 "Content-Type: text/javascript\0" 239 "Content-Type: text/javascript\n"
240 "Expires: Thu, 1 Jan 2100 20:00:00 GMT\0" 240 "Expires: Thu, 1 Jan 2100 20:00:00 GMT\n"
241 "\0"; 241 "\n";
242 std::string headers(kHeaders, arraysize(kHeaders)); 242 std::string headers(kHeaders, arraysize(kHeaders));
243 return new net::URLRequestTestJob( 243 return new net::URLRequestTestJob(
244 request, network_delegate, headers, body_, true); 244 request, network_delegate, headers, body_, true);
245 } 245 }
246 246
247 private: 247 private:
248 std::string body_; 248 std::string body_;
249 DISALLOW_COPY_AND_ASSIGN(LongLivedResourceInterceptor); 249 DISALLOW_COPY_AND_ASSIGN(LongLivedResourceInterceptor);
250 }; 250 };
251 251
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 ASSERT_EQ(SERVICE_WORKER_OK, status); 1285 ASSERT_EQ(SERVICE_WORKER_OK, status);
1286 // Stop the worker. 1286 // Stop the worker.
1287 StopWorker(SERVICE_WORKER_OK); 1287 StopWorker(SERVICE_WORKER_OK);
1288 // Restart the worker. 1288 // Restart the worker.
1289 StartWorker(SERVICE_WORKER_OK); 1289 StartWorker(SERVICE_WORKER_OK);
1290 // Stop the worker. 1290 // Stop the worker.
1291 StopWorker(SERVICE_WORKER_OK); 1291 StopWorker(SERVICE_WORKER_OK);
1292 } 1292 }
1293 1293
1294 } // namespace content 1294 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698