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

Side by Side Diff: LayoutTests/fast/forms/file/input-file-value.html

Issue 148983008: Reduce test code duplication in fast/forms/file (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script src="resources/file-drag-common.js"></script>
5 </head> 6 </head>
6 <body> 7 <body>
7 <input type="file" name="file" id="file"> 8 <input type="file" name="file" id="file">
8 9
9 <script> 10 <script>
10 description("This tests the value attribute in file input forms"); 11 description("This tests the value attribute in file input forms");
11 12
12 if (window.testRunner) { 13 if (window.testRunner) {
13 var file = document.getElementById("file"); 14 var file = document.getElementById("file");
14 dragFilesOntoInput(file, ["foo.txt"]); 15 dragFilesOntoInput(file, ["foo.txt"]);
15 16
16 shouldBeEqualToString("file.value", "C:\\fakepath\\foo.txt"); 17 shouldBeEqualToString("file.value", "C:\\fakepath\\foo.txt");
17 shouldBe("file.files.length", "1"); 18 shouldBe("file.files.length", "1");
18 19
19 shouldThrow("file.value = 'foo'"); 20 shouldThrow("file.value = 'foo'");
20 shouldBeEqualToString("file.value", "C:\\fakepath\\foo.txt"); 21 shouldBeEqualToString("file.value", "C:\\fakepath\\foo.txt");
21 shouldBe("file.files.length", "1"); 22 shouldBe("file.files.length", "1");
22 23
23 file.value = ""; 24 file.value = "";
24 shouldBeEqualToString("file.value", ""); 25 shouldBeEqualToString("file.value", "");
25 shouldBe("file.files.length", "0"); 26 shouldBe("file.files.length", "0");
26 } 27 }
27
28 function moveMouseToCenterOfElement(element) {
29 var centerX = element.offsetLeft + element.offsetWidth / 2;
30 var centerY = element.offsetTop + element.offsetHeight / 2;
31 eventSender.mouseMoveTo(centerX, centerY);
32 }
33
34 function dragFilesOntoInput(input, files) {
35 eventSender.beginDragWithFiles(files);
36 moveMouseToCenterOfElement(input);
37 eventSender.mouseUp();
38 }
39 </script> 28 </script>
40 </body> 29 </body>
41 </html> 30 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/file/file-reset-in-change.html ('k') | LayoutTests/fast/forms/file/input-file-write-files.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698