Index: content/browser/fileapi/file_system_browsertest.cc |
diff --git a/content/browser/fileapi/file_system_browsertest.cc b/content/browser/fileapi/file_system_browsertest.cc |
index fc2e8ddfd6dca9862147230a24d049f2adcf7f63..5e51128d2925c3986a2d373cfa71fa7f93c27aab 100644 |
--- a/content/browser/fileapi/file_system_browsertest.cc |
+++ b/content/browser/fileapi/file_system_browsertest.cc |
@@ -9,6 +9,7 @@ |
#include "base/files/file_path.h" |
#include "base/location.h" |
#include "base/memory/ref_counted.h" |
+#include "base/path_service.h" |
#include "base/single_thread_task_runner.h" |
#include "base/test/thread_test_helper.h" |
#include "content/browser/web_contents/web_contents_impl.h" |
@@ -20,6 +21,7 @@ |
#include "content/public/test/content_browser_test.h" |
#include "content/public/test/content_browser_test_utils.h" |
#include "content/shell/browser/shell.h" |
+#include "content/test/content_browser_test_utils_internal.h" |
#include "storage/browser/quota/quota_manager.h" |
using storage::QuotaManager; |
@@ -93,4 +95,34 @@ IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { |
SimpleTest(GetTestUrl("fileapi", "quota_test.html")); |
} |
+IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, FileInputChooserParams) { |
+ base::FilePath file; |
+ EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file)); |
+ file = file.AppendASCII("bar"); |
+ |
+ NavigateToURL(shell(), GetTestUrl(".", "file_input.html")); |
+ |
+ // Click on the <input type=file> element to launch the file upload picker. |
+ { |
+ std::unique_ptr<FileChooserDelegate> delegate( |
+ new FileChooserDelegate(file)); |
+ shell()->web_contents()->SetDelegate(delegate.get()); |
+ EXPECT_TRUE(ExecuteScript(shell(), |
+ "document.getElementById('fileinput').click();")); |
+ EXPECT_TRUE(delegate->file_chosen()); |
+ EXPECT_TRUE(delegate->params().default_file_name.empty()); |
+ } |
+ |
+ // Click again, to verify what state was maintained and what was not. |
+ { |
+ std::unique_ptr<FileChooserDelegate> delegate( |
+ new FileChooserDelegate(file)); |
+ shell()->web_contents()->SetDelegate(delegate.get()); |
+ EXPECT_TRUE(ExecuteScript(shell(), |
+ "document.getElementById('fileinput').click();")); |
+ EXPECT_TRUE(delegate->file_chosen()); |
+ EXPECT_TRUE(delegate->params().default_file_name.empty()); |
+ } |
+} |
+ |
} // namespace content |