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

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

Issue 2446743002: Remove WebFileChooserParams::initialValue (Closed)
Patch Set: Split test into own file; const sprinkles 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/path_service.h"
6 #include "content/browser/web_contents/web_contents_impl.h"
7 #include "content/public/test/content_browser_test.h"
8 #include "content/public/test/content_browser_test_utils.h"
9 #include "content/shell/browser/shell.h"
10 #include "content/test/content_browser_test_utils_internal.h"
11
12 namespace content {
13
14 // This browser test is aimed towards exercising the FileAPI bindings and
15 // the actual implementation that lives in the browser side.
16 class FileAPIBrowserTest : public ContentBrowserTest {
17 public:
18 FileAPIBrowserTest() {}
19 };
20
21 IN_PROC_BROWSER_TEST_F(FileAPIBrowserTest, FileInputChooserParams) {
22 base::FilePath file;
23 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file));
24 file = file.AppendASCII("bar");
25
26 NavigateToURL(shell(), GetTestUrl(".", "file_input.html"));
27
28 // Click on the <input type=file> element to launch the file upload picker.
29 {
30 std::unique_ptr<FileChooserDelegate> delegate(
31 new FileChooserDelegate(file));
32 shell()->web_contents()->SetDelegate(delegate.get());
33 EXPECT_TRUE(ExecuteScript(shell(),
34 "document.getElementById('fileinput').click();"));
35 EXPECT_TRUE(delegate->file_chosen());
36 EXPECT_TRUE(delegate->params().default_file_name.empty());
37 }
38
39 // Click again, to verify what state was maintained and what was not.
40 // The renderer is expected not to specify a default file name; it's up to
41 // the browser to remember the last selected directory in the profile.
42 {
43 std::unique_ptr<FileChooserDelegate> delegate(
44 new FileChooserDelegate(file));
45 shell()->web_contents()->SetDelegate(delegate.get());
46 EXPECT_TRUE(ExecuteScript(shell(),
47 "document.getElementById('fileinput').click();"));
48 EXPECT_TRUE(delegate->file_chosen());
49 EXPECT_TRUE(delegate->params().default_file_name.empty());
50 }
51 }
52
53 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/file_system_browsertest.cc ('k') | content/renderer/pepper/pepper_file_chooser_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698