Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit b609081

Browse files
xiuqijixHonry
authored andcommitted
Add media capture case. (#3822)
1 parent 1cba273 commit b609081

File tree

10 files changed

+297
-74
lines changed

10 files changed

+297
-74
lines changed

webapi/tct-mediacapture-w3c-tests/mediacapture/capture_video-manual.html

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
All the files except this COPYING come from
2+
https://github.com/w3c/web-platform-tests(commit id: ba98b4fcd36adce91ff52ab4b809bc6bd934a27e)
3+
with modification: Modify reference path to test harness
4+
5+
These tests are copyright by W3C and/or the author listed in the test
6+
file. The tests are dual-licensed under the W3C Test Suite License:
7+
http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
8+
and the BSD 3-clause License:
9+
http://www.w3.org/Consortium/Legal/2008/03-bsd-license
10+
under W3C's test suite licensing policy:
11+
http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright
12+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<meta charset='utf-8'>
3+
<title>HTML Media Capture Test: capture audio to produce one audio file</title>
4+
<link rel='author' title='Intel' href='http://www.intel.com'>
5+
<link rel='help' href='http://dev.w3.org/2009/dap/camera/#attributes'>
6+
<link rel='help' href='http://www.w3.org/TR/html5/forms.html#attr-input-accept'>
7+
<meta name='flags' content='interact'>
8+
<meta name="timeout" content="long">
9+
<script src='../../resources/testharness.js'></script>
10+
<script src='../../resources/testharnessreport.js'></script>
11+
12+
<p>Clear all microphone permissions before running this test. If prompted for permission, please allow.</p>
13+
14+
<p>After hitting the button below, capture an audio and then confirm the capturing.</p>
15+
16+
<p>Note: All the actions need to be done in 60 seconds, otherwise it will get TIMEOUT.</p>
17+
18+
<input type='file' accept='audio/*' capture>
19+
20+
<div id='log'></div>
21+
22+
<script>
23+
var input;
24+
25+
setup(function() {
26+
input = document.querySelector('input[type=file]');
27+
}, {explicit_done: true});
28+
29+
async_test(function(t) {
30+
input.onchange = t.step_func_done(function() {
31+
assert_equals(input.files.length, 1, 'Should capture one file');
32+
assert_regexp_match(input.files[0].type, /^audio\//, 'The captured file should be type of audio');
33+
});
34+
done();
35+
});
36+
</script>
37+
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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<meta charset='utf-8'>
3+
<title>HTML Media Capture Test: capture image to produce one image file</title>
4+
<link rel='author' title='Intel' href='http://www.intel.com'>
5+
<link rel='help' href='http://dev.w3.org/2009/dap/camera/#attributes'>
6+
<link rel='help' href='http://www.w3.org/TR/html5/forms.html#attr-input-accept'>
7+
<meta name='flags' content='interact'>
8+
<meta name="timeout" content="long">
9+
<script src='../../resources/testharness.js'></script>
10+
<script src='../../resources/testharnessreport.js'></script>
11+
12+
<p>Clear all camera permissions before running this test. If prompted for permission, please allow.</p>
13+
14+
<p>After hitting the button below, capture an image and then confirm the capturing.</p>
15+
16+
<p>Note: All the actions need to be done in 60 seconds, otherwise it will get TIMEOUT.</p>
17+
18+
<input type='file' accept='image/*' capture>
19+
20+
<div id='log'></div>
21+
22+
<script>
23+
var input;
24+
25+
setup(function() {
26+
input = document.querySelector('input[type=file]');
27+
}, {explicit_done: true});
28+
29+
async_test(function(t) {
30+
input.onchange = t.step_func_done(function() {
31+
assert_equals(input.files.length, 1, 'Should capture one file');
32+
assert_regexp_match(input.files[0].type, /^image\//, 'The captured file should be type of image');
33+
});
34+
done();
35+
});
36+
</script>
37+
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>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<meta charset='utf-8'>
3+
<title>HTML Media Capture Test: capture video to produce one video file</title>
4+
<link rel='author' title='Intel' href='http://www.intel.com'>
5+
<link rel='help' href='http://dev.w3.org/2009/dap/camera/#attributes'>
6+
<link rel='help' href='http://www.w3.org/TR/html5/forms.html#attr-input-accept'>
7+
<meta name='flags' content='interact'>
8+
<meta name="timeout" content="long">
9+
<script src='../../resources/testharness.js'></script>
10+
<script src='../../resources/testharnessreport.js'></script>
11+
12+
<p>Clear all camera/microphone permissions before running this test. If prompted for permission, please allow.</p>
13+
14+
<p>After hitting the button below, capture an video and then confirm the capturing.</p>
15+
16+
<p>Note: All the actions need to be done in 60 seconds, otherwise it will get TIMEOUT.</p>
17+
18+
<input type='file' accept='video/*' capture>
19+
20+
<div id='log'></div>
21+
22+
<script>
23+
var input;
24+
25+
setup(function() {
26+
input = document.querySelector('input[type=file]');
27+
}, {explicit_done: true});
28+
29+
async_test(function(t) {
30+
input.onchange = t.step_func_done(function() {
31+
assert_equals(input.files.length, 1, 'Should capture one file');
32+
assert_regexp_match(input.files[0].type, /^video\//, 'The captured file should be type of video');
33+
});
34+
done();
35+
});
36+
</script>
37+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello

webapi/tct-mediacapture-w3c-tests/tests.full.xml

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,57 @@
1515
</spec>
1616
</specs>
1717
</testcase>
18-
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_video" priority="P2" purpose="Check if the input will accept an video when capture set to acmcorder" status="approved" type="compliance">
18+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_audio" priority="P1" purpose="Check if the capture audio to produce one audio file" status="approved" type="compliance">
1919
<description>
20-
<pre_condition/>
21-
<post_condition/>
22-
<steps>
23-
<step order="1">
24-
<step_desc>Click the button, allow microphone and camera access, and start to capture a video</step_desc>
25-
<expected>There appears a video capture screen, there is a way to disable the audio record, and there is a way to stop the video capture.</expected>
26-
</step>
27-
</steps>
28-
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/capture_video-manual.html</test_script_entry>
20+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_audio-manual.html</test_script_entry>
21+
</description>
22+
<specs>
23+
<spec>
24+
<spec_assertion category="Tizen W3C API Specifications" element_name="capture" element_type="attribute" interface="HTMLInputElement" section="Media" specification="HTML Media Capture"/>
25+
<spec_url>http://www.w3.org/TR/2012/WD-html-media-capture-20120712/#the-capture-attribute</spec_url>
26+
<spec_statement/>
27+
</spec>
28+
</specs>
29+
</testcase>
30+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_fallback_file_upload" priority="P1" purpose="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" status="approved" type="compliance">
31+
<description>
32+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_fallback_file_upload.html</test_script_entry>
33+
</description>
34+
<specs>
35+
<spec>
36+
<spec_assertion category="Tizen W3C API Specifications" element_name="capture" element_type="attribute" interface="HTMLInputElement" section="Media" specification="HTML Media Capture"/>
37+
<spec_url>http://www.w3.org/TR/2012/WD-html-media-capture-20120712/#the-capture-attribute</spec_url>
38+
<spec_statement/>
39+
</spec>
40+
</specs>
41+
</testcase>
42+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_image" priority="P1" purpose="Check if the capture image to produce one image file" status="approved" type="compliance">
43+
<description>
44+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_image-manual.html</test_script_entry>
45+
</description>
46+
<specs>
47+
<spec>
48+
<spec_assertion category="Tizen W3C API Specifications" element_name="capture" element_type="attribute" interface="HTMLInputElement" section="Media" specification="HTML Media Capture"/>
49+
<spec_url>http://www.w3.org/TR/2012/WD-html-media-capture-20120712/#the-capture-attribute</spec_url>
50+
<spec_statement/>
51+
</spec>
52+
</specs>
53+
</testcase>
54+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="auto" id="capture_reflect" priority="P1" purpose="Check if the input.capture is correct when set different capture value" status="approved" type="compliance" subcase="5">
55+
<description>
56+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_reflect.html</test_script_entry>
57+
</description>
58+
<specs>
59+
<spec>
60+
<spec_assertion category="Tizen W3C API Specifications" element_name="capture" element_type="attribute" interface="HTMLInputElement" section="Media" specification="HTML Media Capture"/>
61+
<spec_url>http://www.w3.org/TR/2012/WD-html-media-capture-20120712/#the-capture-attribute</spec_url>
62+
<spec_statement/>
63+
</spec>
64+
</specs>
65+
</testcase>
66+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_video" priority="P1" purpose="Check if the capture video to produce one video file" status="approved" type="compliance">
67+
<description>
68+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_video-manual.html</test_script_entry>
2969
</description>
3070
<specs>
3171
<spec>

webapi/tct-mediacapture-w3c-tests/tests.xml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,29 @@
88
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/HTMLInputElement_attribute.html</test_script_entry>
99
</description>
1010
</testcase>
11-
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_video" purpose="Check if the input will accept an video when capture set to acmcorder">
11+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_audio" purpose="Check if the capture audio to produce one audio file">
1212
<description>
13-
<steps>
14-
<pre_condition/>
15-
<step order="1">
16-
<step_desc>Click the button, allow microphone and camera access, and start to capture a video</step_desc>
17-
<expected>There appears a video capture screen, there is a way to disable the audio record, and there is a way to stop the video capture.</expected>
18-
</step>
19-
</steps>
20-
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/capture_video-manual.html</test_script_entry>
13+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_audio-manual.html</test_script_entry>
14+
</description>
15+
</testcase>
16+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_fallback_file_upload" purpose="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">
17+
<description>
18+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_fallback_file_upload.html</test_script_entry>
19+
</description>
20+
</testcase>
21+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_image" purpose="Check if the capture image to produce one image file">
22+
<description>
23+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_image-manual.html</test_script_entry>
24+
</description>
25+
</testcase>
26+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="auto" id="capture_reflect" purpose="Check if the input.capture is correct when set different capture value" subcase="5">
27+
<description>
28+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_reflect.html</test_script_entry>
29+
</description>
30+
</testcase>
31+
<testcase component="W3C_HTML5 APIs/Media/HTML Media Capture" execution_type="manual" id="capture_video" purpose="Check if the capture video to produce one video file">
32+
<description>
33+
<test_script_entry>/opt/tct-mediacapture-w3c-tests/mediacapture/w3c/capture_video-manual.html</test_script_entry>
2134
</description>
2235
</testcase>
2336
</set>

0 commit comments

Comments
 (0)