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(); |
+} |