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

Side by Side Diff: google_apis/drive/drive_api_requests_unittest.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 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
« no previous file with comments | « google_apis/drive/drive_api_requests.cc ('k') | google_apis/drive/test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "google_apis/drive/drive_api_requests.h" 5 #include "google_apis/drive/drive_api_requests.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 return std::move(response); 438 return std::move(response);
439 } 439 }
440 440
441 // Handles a request for downloading a file. 441 // Handles a request for downloading a file.
442 std::unique_ptr<net::test_server::HttpResponse> HandleDownloadRequest( 442 std::unique_ptr<net::test_server::HttpResponse> HandleDownloadRequest(
443 const net::test_server::HttpRequest& request) { 443 const net::test_server::HttpRequest& request) {
444 http_request_ = request; 444 http_request_ = request;
445 445
446 const GURL absolute_url = test_server_.GetURL(request.relative_url); 446 const GURL absolute_url = test_server_.GetURL(request.relative_url);
447 std::string id; 447 std::string id;
448 if (!test_util::RemovePrefix( 448 if (!test_util::RemovePrefix(absolute_url.path().as_string(),
449 absolute_url.path(), kTestDownloadPathPrefix, &id) || 449 kTestDownloadPathPrefix, &id) ||
450 absolute_url.query() != kTestDownloadFileQuery) { 450 absolute_url.query() != kTestDownloadFileQuery) {
451 return std::unique_ptr<net::test_server::HttpResponse>(); 451 return std::unique_ptr<net::test_server::HttpResponse>();
452 } 452 }
453 453
454 // For testing, returns a text with |id| repeated 3 times. 454 // For testing, returns a text with |id| repeated 3 times.
455 std::unique_ptr<net::test_server::BasicHttpResponse> response( 455 std::unique_ptr<net::test_server::BasicHttpResponse> response(
456 new net::test_server::BasicHttpResponse); 456 new net::test_server::BasicHttpResponse);
457 response->set_code(net::HTTP_OK); 457 response->set_code(net::HTTP_OK);
458 response->set_content(id + id + id); 458 response->set_content(id + id + id);
459 response->set_content_type("text/plain"); 459 response->set_content_type("text/plain");
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 "Header: value\r\n" 2241 "Header: value\r\n"
2242 "\r\n" 2242 "\r\n"
2243 "BODY\r\n" 2243 "BODY\r\n"
2244 "--BOUNDARY-- \t", 2244 "--BOUNDARY-- \t",
2245 &parts)); 2245 &parts));
2246 ASSERT_EQ(1u, parts.size()); 2246 ASSERT_EQ(1u, parts.size());
2247 EXPECT_EQ(HTTP_SUCCESS, parts[0].code); 2247 EXPECT_EQ(HTTP_SUCCESS, parts[0].code);
2248 EXPECT_EQ("BODY", parts[0].body); 2248 EXPECT_EQ("BODY", parts[0].body);
2249 } 2249 }
2250 } // namespace google_apis 2250 } // namespace google_apis
OLDNEW
« no previous file with comments | « google_apis/drive/drive_api_requests.cc ('k') | google_apis/drive/test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698