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

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

Issue 2121513002: Replace string::find(prefix) == 0 pattern with base::StartsWith(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos Created 4 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
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/download/download_browsertest.h" 5 #include "chrome/browser/download/download_browsertest.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <sstream> 8 #include <sstream>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 2540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2551 // C -> S: GET /foo 2551 // C -> S: GET /foo
2552 // Referer: http://example.com/foo 2552 // Referer: http://example.com/foo
2553 // S -> C: HTTP/1.1 200 OK 2553 // S -> C: HTTP/1.1 200 OK
2554 // Content-Type: text/plain 2554 // Content-Type: text/plain
2555 // 2555 //
2556 // http://example.com/foo 2556 // http://example.com/foo
2557 static std::unique_ptr<net::test_server::HttpResponse> 2557 static std::unique_ptr<net::test_server::HttpResponse>
2558 EchoReferrerRequestHandler(const net::test_server::HttpRequest& request) { 2558 EchoReferrerRequestHandler(const net::test_server::HttpRequest& request) {
2559 const std::string kReferrerHeader = "Referer"; // SIC 2559 const std::string kReferrerHeader = "Referer"; // SIC
2560 2560
2561 if (request.relative_url.find("/echoreferrer") != 0) 2561 if (!base::StartsWith(request.relative_url, "/echoreferrer",
2562 base::CompareCase::SENSITIVE)) {
2562 return std::unique_ptr<net::test_server::HttpResponse>(); 2563 return std::unique_ptr<net::test_server::HttpResponse>();
2564 }
2563 2565
2564 std::unique_ptr<net::test_server::BasicHttpResponse> response( 2566 std::unique_ptr<net::test_server::BasicHttpResponse> response(
2565 new net::test_server::BasicHttpResponse()); 2567 new net::test_server::BasicHttpResponse());
2566 response->set_code(net::HTTP_OK); 2568 response->set_code(net::HTTP_OK);
2567 response->set_content_type("text/plain"); 2569 response->set_content_type("text/plain");
2568 auto referrer_header = request.headers.find(kReferrerHeader); 2570 auto referrer_header = request.headers.find(kReferrerHeader);
2569 if (referrer_header != request.headers.end()) 2571 if (referrer_header != request.headers.end())
2570 response->set_content(referrer_header->second); 2572 response->set_content(referrer_header->second);
2571 return std::move(response); 2573 return std::move(response);
2572 } 2574 }
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
3669 DangerousDownloadWaiter( 3671 DangerousDownloadWaiter(
3670 browser(), 1, 3672 browser(), 1,
3671 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 3673 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
3672 ui_test_utils::NavigateToURL(browser(), extension_url); 3674 ui_test_utils::NavigateToURL(browser(), extension_url);
3673 3675
3674 observer->WaitForFinished(); 3676 observer->WaitForFinished();
3675 3677
3676 // Download shelf should close. 3678 // Download shelf should close.
3677 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 3679 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
3678 } 3680 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698