| Index: chrome/test/ppapi/ppapi_filechooser_browsertest.cc
|
| diff --git a/chrome/test/ppapi/ppapi_filechooser_browsertest.cc b/chrome/test/ppapi/ppapi_filechooser_browsertest.cc
|
| index f6a5b9e2e38a66a0e7a1b19324b3652fe5156431..3d8ed5ffa4d3b6b926469727718adbb928f698cb 100644
|
| --- a/chrome/test/ppapi/ppapi_filechooser_browsertest.cc
|
| +++ b/chrome/test/ppapi/ppapi_filechooser_browsertest.cc
|
| @@ -3,15 +3,18 @@
|
| // found in the LICENSE file.
|
|
|
| #include <map>
|
| +#include <vector>
|
|
|
| #include "base/bind.h"
|
| #include "base/command_line.h"
|
| #include "base/files/file_util.h"
|
| #include "base/files/scoped_temp_dir.h"
|
| +#include "base/strings/string_piece.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/test/ppapi/ppapi_test.h"
|
| +#include "content/public/common/quarantine.h"
|
| #include "ppapi/shared_impl/test_utils.h"
|
| #include "ui/shell_dialogs/select_file_dialog.h"
|
| #include "ui/shell_dialogs/select_file_dialog_factory.h"
|
| @@ -354,6 +357,32 @@ IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_SaveAs_Cancel) {
|
| RunTestViaHTTP("FileChooser_SaveAsCancel");
|
| }
|
|
|
| +#if defined(OS_WIN) || defined(OS_LINUX)
|
| +// On Windows, tests that a file downloaded via PPAPI FileChooser API has the
|
| +// mark-of-the-web. The PPAPI FileChooser implementation invokes QuarantineFile
|
| +// in order to mark the file as being downloaded from the web as soon as the
|
| +// file is created. This MOTW prevents the file being opened without due
|
| +// security warnings if the file is executable.
|
| +IN_PROC_BROWSER_TEST_F(PPAPIFileChooserTest, FileChooser_Quarantine) {
|
| + base::ScopedTempDir temp_dir;
|
| + ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
|
| + base::FilePath suggested_filename = temp_dir.GetPath().AppendASCII("foo");
|
| +
|
| + TestSelectFileDialogFactory::SelectedFileInfoList file_info_list;
|
| + file_info_list.push_back(
|
| + ui::SelectedFileInfo(suggested_filename, suggested_filename));
|
| + TestSelectFileDialogFactory test_dialog_factory(
|
| + TestSelectFileDialogFactory::REPLACE_BASENAME, file_info_list);
|
| +
|
| + RunTestViaHTTP("FileChooser_SaveAsDangerousExecutableAllowed");
|
| + base::FilePath actual_filename =
|
| + temp_dir.GetPath().AppendASCII("dangerous.exe");
|
| +
|
| + ASSERT_TRUE(base::PathExists(actual_filename));
|
| + EXPECT_TRUE(content::IsFileQuarantined(actual_filename, GURL(), GURL()));
|
| +}
|
| +#endif // defined(OS_WIN) || defined(OS_LINUX)
|
| +
|
| #if defined(FULL_SAFE_BROWSING)
|
| // These tests only make sense when SafeBrowsing is enabled. They verify
|
| // that files written via the FileChooser_Trusted API are properly passed
|
|
|