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

Side by Side Diff: net/test/embedded_test_server/embedded_test_server_unittest.cc

Issue 15740023: Revert "Revert 202112 "GTTF: Convert most tests in content to use Embedd..."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 "net/test/embedded_test_server/embedded_test_server.h" 5 #include "net/test/embedded_test_server/embedded_test_server.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "net/http/http_response_headers.h" 9 #include "net/http/http_response_headers.h"
10 #include "net/test/embedded_test_server/http_request.h" 10 #include "net/test/embedded_test_server/http_request.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // |content type|, and |code|. Saves the request URL for verification. 84 // |content type|, and |code|. Saves the request URL for verification.
85 scoped_ptr<HttpResponse> HandleRequest(const std::string& path, 85 scoped_ptr<HttpResponse> HandleRequest(const std::string& path,
86 const std::string& content, 86 const std::string& content,
87 const std::string& content_type, 87 const std::string& content_type,
88 ResponseCode code, 88 ResponseCode code,
89 const HttpRequest& request) { 89 const HttpRequest& request) {
90 request_relative_url_ = request.relative_url; 90 request_relative_url_ = request.relative_url;
91 91
92 GURL absolute_url = server_->GetURL(request.relative_url); 92 GURL absolute_url = server_->GetURL(request.relative_url);
93 if (absolute_url.path() == path) { 93 if (absolute_url.path() == path) {
94 scoped_ptr<HttpResponse> http_response(new HttpResponse); 94 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse);
95 http_response->set_code(code); 95 http_response->set_code(code);
96 http_response->set_content(content); 96 http_response->set_content(content);
97 http_response->set_content_type(content_type); 97 http_response->set_content_type(content_type);
98 return http_response.Pass(); 98 return http_response.PassAs<HttpResponse>();
99 } 99 }
100 100
101 return scoped_ptr<HttpResponse>(); 101 return scoped_ptr<HttpResponse>();
102 } 102 }
103 103
104 protected: 104 protected:
105 int num_responses_received_; 105 int num_responses_received_;
106 int num_responses_expected_; 106 int num_responses_expected_;
107 std::string request_relative_url_; 107 std::string request_relative_url_;
108 base::Thread io_thread_; 108 base::Thread io_thread_;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 EXPECT_EQ("text/html", GetContentTypeFromFetcher(*fetcher2)); 235 EXPECT_EQ("text/html", GetContentTypeFromFetcher(*fetcher2));
236 236
237 EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher3->GetStatus().status()); 237 EXPECT_EQ(URLRequestStatus::SUCCESS, fetcher3->GetStatus().status());
238 EXPECT_EQ(NOT_FOUND, fetcher3->GetResponseCode()); 238 EXPECT_EQ(NOT_FOUND, fetcher3->GetResponseCode());
239 EXPECT_EQ("No chocolates", GetContentFromFetcher(*fetcher3)); 239 EXPECT_EQ("No chocolates", GetContentFromFetcher(*fetcher3));
240 EXPECT_EQ("text/plain", GetContentTypeFromFetcher(*fetcher3)); 240 EXPECT_EQ("text/plain", GetContentTypeFromFetcher(*fetcher3));
241 } 241 }
242 242
243 } // namespace test_server 243 } // namespace test_server
244 } // namespace net 244 } // namespace net
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/embedded_test_server.cc ('k') | net/test/embedded_test_server/http_response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698