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

Unified Diff: components/cronet/android/test/native_test_server.cc

Issue 1376593007: SSL in EmbeddedTestServer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typo fix. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/apps/guest_view/web_view_browsertest.cc ('k') | content/public/test/browser_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/test/native_test_server.cc
diff --git a/components/cronet/android/test/native_test_server.cc b/components/cronet/android/test/native_test_server.cc
index 008fd5d764add37635231679900f7abc1eb82412..566421b43515e97369a2ab1c461319da181bfd05 100644
--- a/components/cronet/android/test/native_test_server.cc
+++ b/components/cronet/android/test/native_test_server.cc
@@ -56,27 +56,7 @@ const char kSdchDictPath[] = "/sdch/dict/";
net::test_server::EmbeddedTestServer* g_test_server = nullptr;
-class CustomHttpResponse : public net::test_server::HttpResponse {
- public:
- CustomHttpResponse(const std::string& headers, const std::string& contents)
- : headers_(headers), contents_(contents) {}
-
- std::string ToResponseString() const override {
- return headers_ + "\r\n" + contents_;
- }
-
- void AddHeader(const std::string& key_value_pair) {
- headers_.append(base::StringPrintf("%s\r\n", key_value_pair.c_str()));
- }
-
- private:
- std::string headers_;
- std::string contents_;
-
- DISALLOW_COPY_AND_ASSIGN(CustomHttpResponse);
-};
-
-scoped_ptr<CustomHttpResponse> ConstructResponseBasedOnFile(
+scoped_ptr<net::test_server::RawHttpResponse> ConstructResponseBasedOnFile(
const base::FilePath& file_path) {
std::string file_contents;
bool read_file = base::ReadFileToString(file_path, &file_contents);
@@ -86,8 +66,8 @@ scoped_ptr<CustomHttpResponse> ConstructResponseBasedOnFile(
std::string headers_contents;
bool read_headers = base::ReadFileToString(headers_path, &headers_contents);
DCHECK(read_headers);
- scoped_ptr<CustomHttpResponse> http_response(
- new CustomHttpResponse(headers_contents, file_contents));
+ scoped_ptr<net::test_server::RawHttpResponse> http_response(
+ new net::test_server::RawHttpResponse(headers_contents, file_contents));
return http_response.Pass();
}
@@ -150,7 +130,7 @@ scoped_ptr<net::test_server::HttpResponse> SdchRequestHandler(
if (base::StartsWith(request.relative_url, kSdchPath,
base::CompareCase::SENSITIVE)) {
base::FilePath file_path = dir_path.Append("sdch/index");
- scoped_ptr<CustomHttpResponse> response =
+ scoped_ptr<net::test_server::RawHttpResponse> response =
ConstructResponseBasedOnFile(file_path).Pass();
// Check for query params to see which dictionary to advertise.
// For instance, ?q=dictionaryA will make the server advertise dictionaryA.
« no previous file with comments | « chrome/browser/apps/guest_view/web_view_browsertest.cc ('k') | content/public/test/browser_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698