summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/file/input-file-value.html
diff options
context:
space:
mode:
authorcommit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2012-10-26 10:18:15 +0000
committercommit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2012-10-26 10:18:15 +0000
commit00c40b9b1028188e1599be0f1de1a6ec8d0435ed (patch)
tree61f0201e637c7af43f4daf5dac96f91b0eb54df8 /third_party/WebKit/LayoutTests/fast/forms/file/input-file-value.html
parent65ad8f02f778d72b976618c4dc05009545a8e7c7 (diff)
downloadchromium_src-00c40b9b1028188e1599be0f1de1a6ec8d0435ed.zip
chromium_src-00c40b9b1028188e1599be0f1de1a6ec8d0435ed.tar.gz
chromium_src-00c40b9b1028188e1599be0f1de1a6ec8d0435ed.tar.bz2
fast/forms/file/input-file-write-files.html should cover correct setting value
https://bugs.webkit.org/show_bug.cgi?id=100085 Patch by Li Yin <li.yin@intel.com> on 2012-10-26 Reviewed by Kentaro Hara. Source/WebCore: From Spec: http://dev.w3.org/html5/spec/single-page.html#dom-input-value-filename On setting, if the new value is the empty string, it must empty the list of selected files; otherwise, it must throw an InvalidStateError exception. Test: fast/forms/file/input-file-value.html * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setValue): (WebCore): * html/HTMLInputElement.h: (HTMLInputElement): * html/HTMLInputElement.idl: LayoutTests: The test input-file-value.html is split from input-file-write-test.html. And add correct setting value for files attribute, verify the files attribute is writable or not. * fast/forms/file/input-file-value-expected.txt: Added. * fast/forms/file/input-file-value.html: Added. * fast/forms/file/input-file-write-files-expected.txt: * fast/forms/file/input-file-write-files.html: git-svn-id: svn://svn.chromium.org/blink/trunk@132599 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/forms/file/input-file-value.html')
-rw-r--r--third_party/WebKit/LayoutTests/fast/forms/file/input-file-value.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/forms/file/input-file-value.html b/third_party/WebKit/LayoutTests/fast/forms/file/input-file-value.html
new file mode 100644
index 0000000..8b79797
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/file/input-file-value.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<input type="file" name="file" id="file">
+
+<script>
+description("This tests the value attribute in file input forms");
+
+if (window.testRunner) {
+ var file = document.getElementById("file");
+ dragFilesOntoInput(file, ["foo.txt"]);
+
+ shouldBeEqualToString("file.value", "C:\\fakepath\\foo.txt");
+ shouldBe("file.files.length", "1");
+
+ shouldThrow("file.value = 'foo'");
+ shouldBeEqualToString("file.value", "C:\\fakepath\\foo.txt");
+ shouldBe("file.files.length", "1");
+
+ file.value = "";
+ shouldBeEqualToString("file.value", "");
+ shouldBe("file.files.length", "0");
+}
+
+function moveMouseToCenterOfElement(element) {
+ var centerX = element.offsetLeft + element.offsetWidth / 2;
+ var centerY = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(centerX, centerY);
+}
+
+function dragFilesOntoInput(input, files) {
+ eventSender.beginDragWithFiles(files);
+ moveMouseToCenterOfElement(input);
+ eventSender.mouseUp();
+}
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>