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

Side by Side Diff: content/browser/fileapi/file_system_browsertest.cc

Issue 2446743002: Remove WebFileChooserParams::initialValue (Closed)
Patch Set: Add browser test Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/path_service.h"
12 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
13 #include "base/test/thread_test_helper.h" 14 #include "base/test/thread_test_helper.h"
14 #include "content/browser/web_contents/web_contents_impl.h" 15 #include "content/browser/web_contents/web_contents_impl.h"
15 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/storage_partition.h" 18 #include "content/public/browser/storage_partition.h"
18 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
19 #include "content/public/test/browser_test_utils.h" 20 #include "content/public/test/browser_test_utils.h"
20 #include "content/public/test/content_browser_test.h" 21 #include "content/public/test/content_browser_test.h"
21 #include "content/public/test/content_browser_test_utils.h" 22 #include "content/public/test/content_browser_test_utils.h"
22 #include "content/shell/browser/shell.h" 23 #include "content/shell/browser/shell.h"
24 #include "content/test/content_browser_test_utils_internal.h"
23 #include "storage/browser/quota/quota_manager.h" 25 #include "storage/browser/quota/quota_manager.h"
24 26
25 using storage::QuotaManager; 27 using storage::QuotaManager;
26 28
27 namespace content { 29 namespace content {
28 30
29 // This browser test is aimed towards exercising the FileAPI bindings and 31 // This browser test is aimed towards exercising the FileAPI bindings and
30 // the actual implementation that lives in the browser side. 32 // the actual implementation that lives in the browser side.
31 class FileSystemBrowserTest : public ContentBrowserTest { 33 class FileSystemBrowserTest : public ContentBrowserTest {
32 public: 34 public:
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 88 }
87 89
88 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { 90 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) {
89 SimpleTest(GetTestUrl("fileapi", "create_test.html")); 91 SimpleTest(GetTestUrl("fileapi", "create_test.html"));
90 } 92 }
91 93
92 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { 94 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) {
93 SimpleTest(GetTestUrl("fileapi", "quota_test.html")); 95 SimpleTest(GetTestUrl("fileapi", "quota_test.html"));
94 } 96 }
95 97
98 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, FileInputChooserParams) {
99 base::FilePath file;
100 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file));
101 file = file.AppendASCII("bar");
102
103 NavigateToURL(shell(), GetTestUrl(".", "file_input.html"));
104
105 // Click on the <input type=file> element to launch the file upload picker.
106 {
107 std::unique_ptr<FileChooserDelegate> delegate(
108 new FileChooserDelegate(file));
109 shell()->web_contents()->SetDelegate(delegate.get());
110 EXPECT_TRUE(ExecuteScript(shell(),
111 "document.getElementById('fileinput').click();"));
112 EXPECT_TRUE(delegate->file_chosen());
113 EXPECT_TRUE(delegate->params().default_file_name.empty());
114 }
115
116 // Click again, to verify what state was maintained and what was not.
117 {
118 std::unique_ptr<FileChooserDelegate> delegate(
119 new FileChooserDelegate(file));
120 shell()->web_contents()->SetDelegate(delegate.get());
121 EXPECT_TRUE(ExecuteScript(shell(),
122 "document.getElementById('fileinput').click();"));
123 EXPECT_TRUE(delegate->file_chosen());
124 EXPECT_TRUE(delegate->params().default_file_name.empty());
125 }
126 }
127
96 } // namespace content 128 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/content_browser_test_utils_internal.h » ('j') | third_party/WebKit/Source/web/ChromeClientImpl.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698