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

Unified Diff: ppapi/tests/test_file_chooser.cc

Issue 1613483003: [SafeBrowsing] Alternate extensions should also be subject to block list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment in histograms.xml Created 4 years, 11 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 | « ppapi/tests/test_file_chooser.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_file_chooser.cc
diff --git a/ppapi/tests/test_file_chooser.cc b/ppapi/tests/test_file_chooser.cc
index 58addc5953ca06550bf19507c4805d023aeabe7e..dbacc0b60858812da26843ff6ea75a7e38406b47 100644
--- a/ppapi/tests/test_file_chooser.cc
+++ b/ppapi/tests/test_file_chooser.cc
@@ -35,6 +35,7 @@ void TestFileChooser::RunTests(const std::string& filter) {
RUN_TEST(SaveAsCancel, filter);
RUN_TEST(SaveAsDangerousExecutableAllowed, filter);
RUN_TEST(SaveAsDangerousExecutableDisallowed, filter);
+ RUN_TEST(SaveAsDangerousExtensionListDisallowed, filter);
}
bool TestFileChooser::WriteDefaultContentsToFile(const pp::FileRef& file_ref) {
@@ -197,3 +198,24 @@ std::string TestFileChooser::TestSaveAsDangerousExecutableDisallowed() {
ASSERT_EQ(0u, output_ref.size());
PASS();
}
+
+// Checks that a dangerous file is not allowed to be downloaded via the
+// FileChooser_Trusted API. Chrome should delegate the decision of which files
+// are allowed over to SafeBrowsing (if enabled), and the current SafeBrowsing
+// configuration should disallow downloading of dangerous files for this test to
+// work.
+std::string TestFileChooser::TestSaveAsDangerousExtensionListDisallowed() {
+ pp::FileChooser_Trusted file_chooser(instance(), PP_FILECHOOSERMODE_OPEN,
+ ".txt,.exe", true /* save_as */,
+ "innocuous.txt");
+ ASSERT_FALSE(file_chooser.is_null());
+
+ TestCompletionCallbackWithOutput<std::vector<pp::FileRef>>
+ filechooser_callback(instance_->pp_instance(), callback_type());
+ filechooser_callback.WaitForResult(
+ file_chooser.Show(filechooser_callback.GetCallback()));
+
+ const std::vector<pp::FileRef>& output_ref = filechooser_callback.output();
+ ASSERT_EQ(0u, output_ref.size());
+ PASS();
+}
« no previous file with comments | « ppapi/tests/test_file_chooser.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698