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

Side by Side Diff: content/browser/download/download_browsertest.cc

Issue 663563002: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
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 // This file contains download browser tests that are known to be runnable 5 // This file contains download browser tests that are known to be runnable
6 // in a pure content context. Over time tests should be migrated here. 6 // in a pure content context. Over time tests should be migrated here.
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 scoped_ptr<net::test_server::HttpResponse> HandleRequestAndSendRedirectResponse( 515 scoped_ptr<net::test_server::HttpResponse> HandleRequestAndSendRedirectResponse(
516 const std::string& relative_url, 516 const std::string& relative_url,
517 const GURL& target_url, 517 const GURL& target_url,
518 const net::test_server::HttpRequest& request) { 518 const net::test_server::HttpRequest& request) {
519 scoped_ptr<net::test_server::BasicHttpResponse> response; 519 scoped_ptr<net::test_server::BasicHttpResponse> response;
520 if (request.relative_url == relative_url) { 520 if (request.relative_url == relative_url) {
521 response.reset(new net::test_server::BasicHttpResponse); 521 response.reset(new net::test_server::BasicHttpResponse);
522 response->set_code(net::HTTP_FOUND); 522 response->set_code(net::HTTP_FOUND);
523 response->AddCustomHeader("Location", target_url.spec()); 523 response->AddCustomHeader("Location", target_url.spec());
524 } 524 }
525 return response.PassAs<net::test_server::HttpResponse>(); 525 return response.Pass();
526 } 526 }
527 527
528 // Creates a request handler for EmbeddedTestServer that responds with a HTTP 528 // Creates a request handler for EmbeddedTestServer that responds with a HTTP
529 // 302 redirect if the request URL matches |relative_url|. 529 // 302 redirect if the request URL matches |relative_url|.
530 EmbeddedTestServer::HandleRequestCallback CreateRedirectHandler( 530 EmbeddedTestServer::HandleRequestCallback CreateRedirectHandler(
531 const std::string& relative_url, 531 const std::string& relative_url,
532 const GURL& target_url) { 532 const GURL& target_url) {
533 return base::Bind( 533 return base::Bind(
534 &HandleRequestAndSendRedirectResponse, relative_url, target_url); 534 &HandleRequestAndSendRedirectResponse, relative_url, target_url);
535 } 535 }
536 536
537 // Request handler to be used with CreateBasicResponseHandler(). 537 // Request handler to be used with CreateBasicResponseHandler().
538 scoped_ptr<net::test_server::HttpResponse> HandleRequestAndSendBasicResponse( 538 scoped_ptr<net::test_server::HttpResponse> HandleRequestAndSendBasicResponse(
539 const std::string& relative_url, 539 const std::string& relative_url,
540 const std::string& content_type, 540 const std::string& content_type,
541 const std::string& body, 541 const std::string& body,
542 const net::test_server::HttpRequest& request) { 542 const net::test_server::HttpRequest& request) {
543 scoped_ptr<net::test_server::BasicHttpResponse> response; 543 scoped_ptr<net::test_server::BasicHttpResponse> response;
544 if (request.relative_url == relative_url) { 544 if (request.relative_url == relative_url) {
545 response.reset(new net::test_server::BasicHttpResponse); 545 response.reset(new net::test_server::BasicHttpResponse);
546 response->set_content_type(content_type); 546 response->set_content_type(content_type);
547 response->set_content(body); 547 response->set_content(body);
548 } 548 }
549 return response.PassAs<net::test_server::HttpResponse>(); 549 return response.Pass();
550 } 550 }
551 551
552 // Creates a request handler for an EmbeddedTestServer that response with an 552 // Creates a request handler for an EmbeddedTestServer that response with an
553 // HTTP 200 status code, a Content-Type header and a body. 553 // HTTP 200 status code, a Content-Type header and a body.
554 EmbeddedTestServer::HandleRequestCallback CreateBasicResponseHandler( 554 EmbeddedTestServer::HandleRequestCallback CreateBasicResponseHandler(
555 const std::string& relative_url, 555 const std::string& relative_url,
556 const std::string& content_type, 556 const std::string& content_type,
557 const std::string& body) { 557 const std::string& body) {
558 return base::Bind( 558 return base::Bind(
559 &HandleRequestAndSendBasicResponse, relative_url, content_type, body); 559 &HandleRequestAndSendBasicResponse, relative_url, content_type, body);
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 ASSERT_TRUE(test_server.InitializeAndWaitUntilReady()); 1814 ASSERT_TRUE(test_server.InitializeAndWaitUntilReady());
1815 1815
1816 GURL url = test_server.GetURL("/empty.bin"); 1816 GURL url = test_server.GetURL("/empty.bin");
1817 test_server.ServeFilesFromDirectory(GetTestFilePath("download", "")); 1817 test_server.ServeFilesFromDirectory(GetTestFilePath("download", ""));
1818 1818
1819 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE); 1819 NavigateToURLAndWaitForDownload(shell(), url, DownloadItem::COMPLETE);
1820 // That's it. This should work without crashing. 1820 // That's it. This should work without crashing.
1821 } 1821 }
1822 1822
1823 } // namespace content 1823 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.cc ('k') | content/browser/download/download_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698