Skip to content

File tree

4 files changed

+152
-0
lines changed

4 files changed

+152
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset='utf-8'>
5+
<title>HTML Media Capture Test: capture_fallback_file_upload</title>
6+
<link rel='author' title='Intel' href='http://www.intel.com'>
7+
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'>
8+
<link rel='help' href='http://www.w3.org/TR/html5/forms.html#file-upload-state-(type=file)'>
9+
<meta name='flags' content='interact'>
10+
<script src='/resources/testharness.js'></script>
11+
<script src='/resources/testharnessreport.js'></script>
12+
</head>
13+
<body>
14+
<p>This test validates that the user agent must act as if there was no capture attribute, when the accept attribute value is set to a MIME type that has no associated capture control type.</p>
15+
16+
<p>Test steps:</p>
17+
<ol>
18+
<li>Download <a href='support/upload.txt'>upload.txt</a> to local.</li>
19+
<li>Select the local upload.txt file to run the test.</li>
20+
</ol>
21+
22+
<form>
23+
<input id='fileChooser' type='file' accept='text/plain' capture>
24+
</form>
25+
26+
<div id='log'></div>
27+
28+
<script>
29+
setup({explicit_done: true, explicit_timeout: true});
30+
31+
var fileInput = document.querySelector('#fileChooser');
32+
33+
on_event(fileInput, 'change', function(evt) {
34+
test(function() {
35+
var fileList = document.querySelector('#fileChooser').files;
36+
assert_equals(fileList.length, 1, 'fileList length is 1');
37+
assert_equals(fileList.item(0).name, 'upload.txt', 'file name string is "upload.txt"');
38+
}, 'Check if input.capture fallback to file upload when the accept attribute value is set to a MIME type that has no associated capture control type');
39+
40+
done();
41+
});
42+
</script>
43+
</body>
44+
</html>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset='utf-8'>
5+
<title>HTML Media Capture Test: capture_reflect</title>
6+
<link rel='author' title='Intel' href='http://www.intel.com/'>
7+
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'>
8+
<link rel='help' href='http://www.w3.org/html/wg/drafts/html/CR/infrastructure.html#reflect'>
9+
<link rel='help' href='http://www.w3.org/html/wg/drafts/html/CR/infrastructure.html#boolean-attributes'>
10+
<meta name='flags' content='dom'>
11+
<meta name='assert' content='Test checks that the capture IDL attribute must reflect the content attribute of the same name.'>
12+
<script src='/resources/testharness.js'></script>
13+
<script src='/resources/testharnessreport.js'></script>
14+
</head>
15+
<body>
16+
<pre style='display:none'>
17+
partial interface HTMLInputElement {
18+
attribute boolean capture;
19+
};
20+
</pre>
21+
22+
<div style='display:none'>
23+
<input id='absent' type='file' accept='image/*'>
24+
<input id='present' type='file' accept='image/*' capture>
25+
<input id='present-empty-string' type='file' accept='image/*' capture=''>
26+
<input id='present-canonical-name' type='file' accept='image/*' capture=capture>
27+
</div>
28+
29+
<div id='log'></div>
30+
31+
<script>
32+
test(function() {
33+
var inputs = document.querySelectorAll('input');
34+
for (var i=0, obj; i<inputs.length, obj=inputs[i]; i++) {
35+
assert_own_property(obj, 'capture');
36+
assert_equals(typeof obj.capture, 'boolean');
37+
}
38+
}, 'Element input should have own property capture');
39+
40+
test(function() {
41+
assert_false(document.querySelector('#absent').capture);
42+
}, 'input.capture is false when the capture attribute is absent');
43+
44+
test(function() {
45+
assert_true(document.querySelector('#present').capture);
46+
}, 'input.capture is true when the capture attribute is present');
47+
48+
test(function() {
49+
assert_true(document.querySelector('#present-empty-string').capture);
50+
}, 'input.capture is true when the capture attribute is present as empty string');
51+
52+
test(function() {
53+
assert_true(document.querySelector('#present-canonical-name').capture);
54+
}, 'input.capture is true when the capture attribute is present as canonical name');
55+
</script>
56+
</body>
57+
</html>

html-media-capture/idlharness.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset='utf-8'>
5+
<title>HTML Media Capture IDL tests</title>
6+
<link rel='author' title='Intel' href='http://www.intel.com/'>
7+
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#conformance'>
8+
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'>
9+
<script src='/resources/testharness.js'></script>
10+
<script src='/resources/testharnessreport.js'></script>
11+
<script src='/resources/WebIDLParser.js'></script>
12+
<script src='/resources/idlharness.js'></script>
13+
</head>
14+
<body>
15+
<h1>HTML Media Capture IDL tests</h1>
16+
<div id='log'></div>
17+
18+
<pre id='untested_idl' style='display:none'>
19+
interface HTMLInputElement {
20+
};
21+
interface HTMLElement {
22+
};
23+
interface Element{
24+
};
25+
</pre>
26+
27+
<pre id='idl' style='display:none'>
28+
partial interface HTMLInputElement {
29+
attribute boolean capture;
30+
};
31+
</pre>
32+
33+
<form style='display:none'>
34+
<input id='testElement' type='file' accept='image/*' capture>
35+
</form>
36+
37+
<script>
38+
(function() {
39+
var idl_array = new IdlArray();
40+
41+
idl_array.add_untested_idls(document.getElementById('untested_idl').textContent);
42+
idl_array.add_idls(document.getElementById('idl').textContent);
43+
44+
var testElement = document.getElementById('testElement');
45+
idl_array.add_objects({HTMLInputElement: [testElement]});
46+
idl_array.test();
47+
})();
48+
</script>
49+
</body>
50+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello

0 commit comments

Comments
 (0)