| Index: net/test/embedded_test_server/request_helpers.h | 
| diff --git a/net/test/embedded_test_server/request_helpers.h b/net/test/embedded_test_server/request_helpers.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..4a12cd96cf739413dc3825083fb3a9aff1a84aaf | 
| --- /dev/null | 
| +++ b/net/test/embedded_test_server/request_helpers.h | 
| @@ -0,0 +1,60 @@ | 
| +// Copyright 2015 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef NET_TEST_EMBEDDED_TEST_SERVER_REQUEST_HELPERS_H_ | 
| +#define NET_TEST_EMBEDDED_TEST_SERVER_REQUEST_HELPERS_H_ | 
| + | 
| +#include <utility> | 
| + | 
| +#include "base/files/file_path.h" | 
| +#include "base/strings/string_split.h" | 
| +#include "net/test/embedded_test_server/embedded_test_server.h" | 
| +#include "net/test/embedded_test_server/http_request.h" | 
| +#include "net/test/embedded_test_server/http_response.h" | 
| +#include "url/gurl.h" | 
| + | 
| +namespace net { | 
| +namespace test_server { | 
| + | 
| +// This file is only meant for compatibility with testserver.py. No | 
| +// additional handlers should be added here that don't affect multiple | 
| +// distinct tests. | 
| + | 
| +class CustomHttpResponse : public HttpResponse { | 
| + public: | 
| +  CustomHttpResponse(const std::string& headers, const std::string& contents) | 
| +      : headers_(headers), contents_(contents) {} | 
| + | 
| +  void SendResponse(SendCallback send, SendDoneCallback done) override; | 
| + | 
| + private: | 
| +  std::string headers_; | 
| +  std::string contents_; | 
| + | 
| +  DISALLOW_COPY_AND_ASSIGN(CustomHttpResponse); | 
| +}; | 
| + | 
| +typedef std::map<std::string, std::vector<std::string>> RequestQuery; | 
| + | 
| +// Parses |data| as the query of a URL and places it into a map. | 
| +RequestQuery ParseQuery(GURL url); | 
| + | 
| +// Handles |request| by serving a file from under |server_root|. | 
| +scoped_ptr<HttpResponse> HandleFileRequest(const base::FilePath& server_root, | 
| +                                           const HttpRequest& request); | 
| + | 
| +// Registers default handlers for use in tests. | 
| +void RegisterDefaultHandlers(EmbeddedTestServer* server); | 
| + | 
| +// Returns a path that serves |original_path| with text that matches | 
| +// |text_to_replace| with the corresponding values, and then returns the | 
| +// resulting path in |replacement_path|. | 
| +void GetFilePathWithReplacements(const std::string& original_path, | 
| +                                 const base::StringPairs& text_to_replace, | 
| +                                 std::string* replacement_path); | 
| + | 
| +}  // namespace test_server | 
| +}  // namespace net | 
| + | 
| +#endif  // NET_TEST_EMBEDDED_TEST_SERVER_REQUEST_HELPERS_H_ | 
|  |