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

Side by Side Diff: chrome/browser/google_apis/test_util.cc

Issue 16268017: GTTF: convert some tests in chrome to use EmbeddedTestServer patch nr 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 5 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 "chrome/browser/google_apis/test_util.h" 5 #include "chrome/browser/google_apis/test_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 std::string content; 132 std::string content;
133 if (!file_util::ReadFileToString(file_path, &content)) 133 if (!file_util::ReadFileToString(file_path, &content))
134 return scoped_ptr<net::test_server::BasicHttpResponse>(); 134 return scoped_ptr<net::test_server::BasicHttpResponse>();
135 135
136 std::string content_type = "text/plain"; 136 std::string content_type = "text/plain";
137 if (EndsWith(file_path.AsUTF8Unsafe(), ".json", true /* case sensitive */)) 137 if (EndsWith(file_path.AsUTF8Unsafe(), ".json", true /* case sensitive */))
138 content_type = "application/json"; 138 content_type = "application/json";
139 139
140 scoped_ptr<net::test_server::BasicHttpResponse> http_response( 140 scoped_ptr<net::test_server::BasicHttpResponse> http_response(
141 new net::test_server::BasicHttpResponse); 141 new net::test_server::BasicHttpResponse);
142 http_response->set_code(net::test_server::SUCCESS); 142 http_response->set_code(net::HTTP_OK);
143 http_response->set_content(content); 143 http_response->set_content(content);
144 http_response->set_content_type(content_type); 144 http_response->set_content_type(content_type);
145 return http_response.Pass(); 145 return http_response.Pass();
146 } 146 }
147 147
148 scoped_ptr<net::test_server::HttpResponse> HandleDownloadFileRequest( 148 scoped_ptr<net::test_server::HttpResponse> HandleDownloadFileRequest(
149 const GURL& base_url, 149 const GURL& base_url,
150 net::test_server::HttpRequest* out_request, 150 net::test_server::HttpRequest* out_request,
151 const net::test_server::HttpRequest& request) { 151 const net::test_server::HttpRequest& request) {
152 *out_request = request; 152 *out_request = request;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return result; 236 return result;
237 } 237 }
238 238
239 void TestGetContentCallback::OnGetContent(google_apis::GDataErrorCode error, 239 void TestGetContentCallback::OnGetContent(google_apis::GDataErrorCode error,
240 scoped_ptr<std::string> data) { 240 scoped_ptr<std::string> data) {
241 data_.push_back(data.release()); 241 data_.push_back(data.release());
242 } 242 }
243 243
244 } // namespace test_util 244 } // namespace test_util
245 } // namespace google_apis 245 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/gdata_wapi_requests_unittest.cc ('k') | chrome/browser/infobars/infobars_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698