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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 1648
1649 EXPECT_EQ(1, browser()->tab_strip_model()->count()); 1649 EXPECT_EQ(1, browser()->tab_strip_model()->count());
1650 // Download shelf should close. Download panel stays open on ChromeOS. 1650 // Download shelf should close. Download panel stays open on ChromeOS.
1651 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 1651 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
1652 1652
1653 CheckDownload(browser(), file, file); 1653 CheckDownload(browser(), file, file);
1654 } 1654 }
1655 1655
1656 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) { 1656 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryCheck) {
1657 GURL download_url(URLRequestSlowDownloadJob::kKnownSizeUrl); 1657 GURL download_url(URLRequestSlowDownloadJob::kKnownSizeUrl);
1658 base::FilePath file(net::GenerateFileName(download_url, "", "", "", "", "")); 1658 base::FilePath file(net::GenerateFileName(download_url,
1659 std::string(),
1660 std::string(),
1661 std::string(),
1662 std::string(),
1663 std::string()));
1659 1664
1660 // We use the server so that we can get a redirect and test url_chain 1665 // We use the server so that we can get a redirect and test url_chain
1661 // persistence. 1666 // persistence.
1662 ASSERT_TRUE(test_server()->Start()); 1667 ASSERT_TRUE(test_server()->Start());
1663 GURL redirect_url = test_server()->GetURL( 1668 GURL redirect_url = test_server()->GetURL(
1664 "server-redirect?" + download_url.spec()); 1669 "server-redirect?" + download_url.spec());
1665 1670
1666 // Download the url and wait until the object has been stored. 1671 // Download the url and wait until the object has been stored.
1667 base::Time start(base::Time::Now()); 1672 base::Time start(base::Time::Now());
1668 HistoryObserver observer(browser()->profile()); 1673 HistoryObserver observer(browser()->profile());
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 CheckDownloadStates(1, DownloadItem::COMPLETE); 2625 CheckDownloadStates(1, DownloadItem::COMPLETE);
2621 2626
2622 // Validate that the correct file was downloaded. 2627 // Validate that the correct file was downloaded.
2623 GetDownloads(browser(), &download_items); 2628 GetDownloads(browser(), &download_items);
2624 ASSERT_EQ(1u, download_items.size()); 2629 ASSERT_EQ(1u, download_items.size());
2625 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"), 2630 ASSERT_EQ(test_server()->GetURL("echoheader?Referer"),
2626 download_items[0]->GetOriginalUrl()); 2631 download_items[0]->GetOriginalUrl());
2627 2632
2628 // Check that the file contains the expected referrer. 2633 // Check that the file contains the expected referrer.
2629 base::FilePath file(download_items[0]->GetFullPath()); 2634 base::FilePath file(download_items[0]->GetFullPath());
2630 std::string expected_contents = test_server()->GetURL("").spec(); 2635 std::string expected_contents = test_server()->GetURL(std::string()).spec();
2631 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length())); 2636 ASSERT_TRUE(VerifyFile(file, expected_contents, expected_contents.length()));
2632 } 2637 }
2633 2638
2634 IN_PROC_BROWSER_TEST_F(DownloadTest, HiddenDownload) { 2639 IN_PROC_BROWSER_TEST_F(DownloadTest, HiddenDownload) {
2635 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 2640 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
2636 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 2641 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
2637 2642
2638 scoped_refptr<DownloadManager> download_manager = 2643 scoped_refptr<DownloadManager> download_manager =
2639 DownloadManagerForBrowser(browser()); 2644 DownloadManagerForBrowser(browser());
2640 scoped_ptr<content::DownloadTestObserver> observer( 2645 scoped_ptr<content::DownloadTestObserver> observer(
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2922 scoped_ptr<content::DownloadTestObserver> observer( 2927 scoped_ptr<content::DownloadTestObserver> observer(
2923 DangerousDownloadWaiter( 2928 DangerousDownloadWaiter(
2924 browser(), 1, 2929 browser(), 1,
2925 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 2930 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
2926 ui_test_utils::NavigateToURL(browser(), url); 2931 ui_test_utils::NavigateToURL(browser(), url);
2927 observer->WaitForFinished(); 2932 observer->WaitForFinished();
2928 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED)); 2933 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED));
2929 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); 2934 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen());
2930 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 2935 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
2931 } 2936 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | chrome/browser/download/download_file_picker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698