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

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

Issue 2124373002: [PPAPI] Quarantine files that are writeable by a Pepper plugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@consolidate-file-metadata
Patch Set: . Created 4 years 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
Index: chrome/browser/download/download_browsertest.cc
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index d77460ed360a09ed21f54ba061a39d950358dd2f..a9c4a33a3741a3219b68ffc225d2b47ebf6e858f 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -91,6 +91,7 @@
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/context_menu_params.h"
+#include "content/public/common/quarantine.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/download_test_observer.h"
#include "content/public/test/test_file_error_injector.h"
@@ -1176,10 +1177,13 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) {
CheckDownload(browser(), file, file);
}
-#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_DependsOnLocalConfig) {
+#if defined(OS_WIN) || defined(OS_LINUX)
+// Download a file and confirm that the file is correctly quarantined.
+//
+// TODO(asanka): We should enable the test on Mac as well, but currently
+// |browser_tests| aren't run from a process that has LSFileQuarantineEnabled
Avi (use Gerrit) 2016/12/02 19:58:27 The lack of LSFileQuarantineEnabled shouldn't be a
asanka 2016/12/06 20:34:36 Acknowledged. This is what we do for the unit test
+// bit set.
+IN_PROC_BROWSER_TEST_F(DownloadTest, Quarantine_DependsOnLocalConfig) {
GURL url(URLRequestMockHTTPJob::GetMockUrl(kDownloadTest1Path));
// Download the file and wait. We do not expect the Select File dialog.
@@ -1190,10 +1194,16 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone_DependsOnLocalConfig) {
EXPECT_EQ(1, browser()->tab_strip_model()->count());
base::FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
base::FilePath downloaded_file(DestinationFile(browser(), file));
- if (base::VolumeSupportsADS(downloaded_file))
- EXPECT_TRUE(base::HasInternetZoneIdentifier(downloaded_file));
+ EXPECT_TRUE(content::IsFileQuarantined(downloaded_file, url, GURL()));
CheckDownload(browser(), file, file);
}
+#endif
+
+#if defined(OS_WIN)
+// A couple of Windows specific tests to make sure we respect OS specific
+// restrictions on MOTW can be applied. While Chrome doesn't directly apply
brettw 2016/12/06 22:48:42 I don't know what "MOTW" is ("message of the week"
asanka 2016/12/08 15:13:29 Done :-)
+// these policies, Chrome still needs to make sure the correct APIs are invoked
+// during the download process that result in the expected MOTW behavior.
// Downloading a file from the local host shouldn't cause the application of a
// zone identifier.
@@ -1208,7 +1218,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CheckLocalhostZone_DependsOnLocalConfig) {
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));
+ EXPECT_FALSE(content::IsFileQuarantined(downloaded_file, GURL(), GURL()));
}
// Same as the test above, but uses a file:// URL to a local file.
@@ -1221,7 +1231,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CheckLocalFileZone_DependsOnLocalConfig) {
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));
+ EXPECT_FALSE(content::IsFileQuarantined(downloaded_file, GURL(), GURL()));
}
#endif

Powered by Google App Engine
This is Rietveld 408576698