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

Unified Diff: chrome/browser/download/download_browsertest.cc

Issue 2384713004: [downloads] Correctly plumb client ID for download file scanning. (Closed)
Patch Set: . Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_browsertest.cc
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index a6962a3b39d3019b45d3dc44b90393892f0f9881..6612712e29c1d7238d04672651571883a0a097d1 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -1179,7 +1179,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) {
#if defined(OS_WIN)
// Download a file and confirm that the zone identifier (on windows)
// is set to internet.
-IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone) {
+IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone_DependsOnLocalConfig) {
GURL url(URLRequestMockHTTPJob::GetMockUrl(kDownloadTest1Path));
// Download the file and wait. We do not expect the Select File dialog.
@@ -1194,6 +1194,35 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone) {
EXPECT_TRUE(base::HasInternetZoneIdentifier(downloaded_file));
CheckDownload(browser(), file, file);
}
+
+// Downloading a file from the local host shouldn't cause the application of a
+// zone identifier.
+IN_PROC_BROWSER_TEST_F(DownloadTest, CheckLocalhostZone_DependsOnLocalConfig) {
+ embedded_test_server()->ServeFilesFromDirectory(GetTestDataDirectory());
+ ASSERT_TRUE(embedded_test_server()->Start());
+
+ // Assumes that localhost maps to 127.0.0.1. Otherwise the test will fail
+ // since EmbeddedTestServer is listening on that address.
+ GURL url =
+ embedded_test_server()->GetURL("localhost", "/downloads/a_zip_file.zip");
+ DownloadAndWait(browser(), url);
+ base::FilePath file(FILE_PATH_LITERAL("a_zip_file.zip"));
+ base::FilePath downloaded_file(DestinationFile(browser(), file));
+ EXPECT_FALSE(base::HasInternetZoneIdentifier(downloaded_file));
+}
+
+// Same as the test above, but uses a file:// URL to a local file.
+IN_PROC_BROWSER_TEST_F(DownloadTest, CheckLocalFileZone_DependsOnLocalConfig) {
+ base::FilePath source_file = GetTestDataDirectory()
+ .AppendASCII("downloads")
+ .AppendASCII("a_zip_file.zip");
+
+ GURL url = net::FilePathToFileURL(source_file);
+ DownloadAndWait(browser(), url);
+ base::FilePath file(FILE_PATH_LITERAL("a_zip_file.zip"));
+ base::FilePath downloaded_file(DestinationFile(browser(), file));
+ EXPECT_FALSE(base::HasInternetZoneIdentifier(downloaded_file));
+}
#endif
// Put up a Select File dialog when the file is downloaded, due to
« no previous file with comments | « no previous file | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698