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

Side by Side Diff: LayoutTests/fast/forms/file/selected-file-survives-navigation.html

Issue 428733008: Failing test for http://crbug.com/398366. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tweaked. Created 6 years, 4 months 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/file/selected-file-survives-navigation-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script src="resources/file-drag-common.js"></script>
6 </head>
7 <body>
8 <p id="dropTarget" style="width: 200px; padding: 20px; border: 1px solid black;" >
9 To run this test manually, drag a file named "foo.txt" onto this box.
10 </p>
11
12 <input type="file" name="file" id="fileInput">
13
14 <script>
15 description('Check that the value of an &lt;input type="file"> sourced from a dr ag-and-drop operation survives navigation');
16
17 var jsTestIsAsync = true;
18
19 var dropTarget = document.getElementById("dropTarget");
20 var fileInput = document.getElementById("fileInput");
21
22 window.addEventListener("popstate", function() {
23 // This runs after the simulated Back button press.
24 shouldBe("fileInput.files.length", "1");
25 shouldBeEqualToString("fileInput.files.item(0).name", "foo.txt");
26 finishJSTest();
27 });
28
29 dropTarget.addEventListener('dragenter', function (event) {
30 event.preventDefault();
31 });
32 dropTarget.addEventListener('dragover', function (event) {
33 event.preventDefault();
34 });
35 dropTarget.addEventListener("drop", function(event) {
36 fileInput.files = event.dataTransfer.files;
37 event.preventDefault();
38
39 // This causes popstate to fire when history.back() is used.
40 history.pushState({}, "selected-file-survives.navigation.html");
41
42 // Simulate the user going to a different page and pressing the Back button.
43 var goBackPage = "<script>history.back();<" + "/script>;";
44 window.location.href = "data:text/html;charset=UTF-8," + encodeURIComponent( goBackPage);
45 });
46
47 window.addEventListener("load", function() {
48 if (window.testRunner) {
49 dragFilesOntoElement(dropTarget, ["foo.txt"]);
50 }
51 });
52 </script>
53 </body>
54 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/forms/file/selected-file-survives-navigation-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698