-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created tests for http://www.w3.org/TR/html-media-capture/ #306
Changes from 3 commits
aef49cb
5681ce4
ba9b637
34554fa
58c7d66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_audio</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#security'> | ||
<meta name="flags" content="interact should"> | ||
</head> | ||
<body> | ||
<p>Click the button, allow microphone access, and start to record a audio.</p> | ||
|
||
<p>Test passes</p> | ||
<ol> | ||
<li>if there appears an audio record screen, and</li> | ||
<li>if there is a way to stop the audio record.</li> | ||
</ol> | ||
|
||
<input type='file' accept='audio/*' capture> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_audio_deny</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#security'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<meta name="flags" content="interact should"> | ||
</head> | ||
<body> | ||
<p><strong>Make sure that there is no granted microphone access.</strong></p> | ||
|
||
<p>Click the button, <strong>deny</strong> microphone access.</p> | ||
|
||
<p>Test passes</p> | ||
<ol> | ||
<li>if there appears <strong>no</strong> audio record screen, and</li> | ||
<li>if there is <strong>no</strong> way to upload audio file.</li> | ||
</ol> | ||
|
||
<input type='file' accept='audio/*' capture> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_fallback_file_upload</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<link rel='help' href='http://www.w3.org/TR/html5/forms.html#file-upload-state-(type=file)'> | ||
<meta name='flags' content='interact'> | ||
<script src='/resources/testharness.js'></script> | ||
<script src='/resources/testharnessreport.js'></script> | ||
</head> | ||
<body> | ||
<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> | ||
|
||
<p>Test steps:</p> | ||
<ol> | ||
<li>Download <a href='support/upload.txt'>upload.txt</a> to local.</li> | ||
<li>Select the local upload.txt file to run the test.</li> | ||
</ol> | ||
|
||
<form> | ||
<input id='fileChooser' type='file' accept='text/plain' capture> | ||
</form> | ||
|
||
<div id='log'></div> | ||
|
||
<script> | ||
setup({explicit_done: true, explicit_timeout: true}); | ||
|
||
var fileInput = document.querySelector('#fileChooser'); | ||
|
||
on_event(fileInput, 'change', function(evt) { | ||
test(function() { | ||
var fileList = document.querySelector('#fileChooser').files; | ||
assert_equals(fileList.length, 1, 'fileList length is 1'); | ||
assert_equals(fileList.item(0).name, 'upload.txt', 'file name string is "upload.txt"'); | ||
}, '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'); | ||
|
||
done(); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_image</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#security'> | ||
<meta name="flags" content="interact should"> | ||
</head> | ||
<body> | ||
<p>Click the button, allow camera access, and start to capture an image.</p> | ||
|
||
<p>Test passes</p> | ||
<ol> | ||
<li>if there appears an image capture screen, and</li> | ||
<li>if there is a way to stop the image capture.</li> | ||
</ol> | ||
|
||
<input type='file' accept='image/*' capture> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_image_deny</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#security'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<meta name="flags" content="interact should"> | ||
</head> | ||
<body> | ||
<p><strong>Make sure that there is no granted camera access.</strong></p> | ||
|
||
<p>Click the button, <strong>deny</strong> camera access.</p> | ||
|
||
<p>Test passes</p> | ||
<ol> | ||
<li>if there appears <strong>no</strong> image capture screen, and</li> | ||
<li>if there is <strong>no</strong> way to upload image file.</li> | ||
</ol> | ||
|
||
<input type='file' accept='image/*' capture> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_image_multiple_device</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#security'> | ||
<meta name="flags" content="interact should"> | ||
</head> | ||
<body> | ||
<p><strong>This test is only useful on devices that supports multiple cameras (e.g. a front-facing camera in addition to a primary camera).</strong></p> | ||
|
||
<p>Click the button, allow camera access, and start to capture an image.</p> | ||
|
||
<p>Test passes</p> | ||
<ol> | ||
<li>if there appears an image capture screen,</li> | ||
<li>if there is a way to change camera, and</li> | ||
<li>if there is a way to stop the image capture.</li> | ||
</ol> | ||
|
||
<input type='file' accept='image/*' capture> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_reflect</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com/'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<link rel='help' href='http://www.w3.org/html/wg/drafts/html/CR/infrastructure.html#reflect'> | ||
<link rel='help' href='http://www.w3.org/html/wg/drafts/html/CR/infrastructure.html#boolean-attributes'> | ||
<meta name='flags' content='dom'> | ||
<meta name='assert' content='Test checks that the capture IDL attribute must reflect the content attribute of the same name.'> | ||
<script src='/resources/testharness.js'></script> | ||
<script src='/resources/testharnessreport.js'></script> | ||
</head> | ||
<body> | ||
<pre style='display:none'> | ||
partial interface HTMLInputElement { | ||
attribute boolean capture; | ||
}; | ||
</pre> | ||
|
||
<div style='display:none'> | ||
<input id='absent' type='file' accept='image/*'> | ||
<input id='present' type='file' accept='image/*' capture> | ||
<input id='present-empty-string' type='file' accept='image/*' capture=''> | ||
<input id='present-canonical-name' type='file' accept='image/*' capture=capture> | ||
</div> | ||
|
||
<div id='log'></div> | ||
|
||
<script> | ||
test(function() { | ||
var inputs = document.querySelector('input'); | ||
for (var obj in inputs) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of for..in loop on a NodeList object is not recommended, as it would loop through other properties of the NodeList. See https://developer.mozilla.org/en-US/docs/Web/API/NodeList A simple for loop should be used instead: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cathychan, thanks for the review and comments, updated. |
||
assert_own_property(obj, 'capture'); | ||
assert_equals(typeof obj.capture, 'boolean'); | ||
} | ||
}, 'Element input should have own property capture'); | ||
|
||
test(function() { | ||
assert_false(document.querySelector('#absent').capture); | ||
}, 'input.capture is false when the capture attribute is absent'); | ||
|
||
test(function() { | ||
assert_true(document.querySelector('#present').capture); | ||
}, 'input.capture is true when the capture attribute is present'); | ||
|
||
test(function() { | ||
assert_true(document.querySelector('#present-empty-string').capture); | ||
}, 'input.capture is true when the capture attribute is present as empty string'); | ||
|
||
test(function() { | ||
assert_true(document.querySelector('#present-canonical-name').capture); | ||
}, 'input.capture is true when the capture attribute is present as canonical name'); | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_video</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#security'> | ||
<meta name="flags" content="interact should"> | ||
</head> | ||
<body> | ||
<p>Click the button, allow microphone and camera access, and start to capture a video.</p> | ||
|
||
<p>Test passes</p> | ||
<ol> | ||
<li>if there appears a video capture screen,</li> | ||
<li>if there is a way to disable the audio record, and</li> | ||
<li>if there is a way to stop the video capture.</li> | ||
</ol> | ||
|
||
<input type='file' accept='video/*' capture> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_video</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#security'> | ||
<meta name="flags" content="interact should"> | ||
</head> | ||
<body> | ||
<p><strong>Make sure that there is no granted microphone or camera access.</strong></p> | ||
|
||
<p>Click the button, <strong>deny</strong> microphone and camera access.</p> | ||
|
||
<p>Test passes</p> | ||
<ol> | ||
<li>if there appears <strong>no</strong> video capture screen, and</li> | ||
<li>if there is <strong>no</strong> way to upload audio or video file.</li> | ||
</ol> | ||
|
||
<input type='file' accept='video/*' capture> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture Test: capture_video_multiple_device</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#security'> | ||
<meta name="flags" content="interact should"> | ||
</head> | ||
<body> | ||
<p><strong>This test is only useful on devices that supports multiple cameras (e.g. a front-facing camera in addition to a primary camera).</strong></p> | ||
|
||
<p>Click the button, allow microphone and camera access, and start to capture a video.</p> | ||
|
||
<p>Test passes</p> | ||
<ol> | ||
<li>if there appears a video capture screen,</li> | ||
<li>if there is a way to change camera,</li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't normative. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review. http://www.w3.org/TR/html-media-capture/#security, says,
As the test said, it is only for > 1 cameras. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tobie, looking back to the spec, I find below statement. Could you please review this again? Many thanks. [[ As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for dropping the ball on this. I read the spec as: if your device has two camera's "there So basically, there might be might be situations where it's OK not to offer this option to the user and still be spec compliant. So this brings up a methodology question of how we should deal with this in practice. This has been discussed in the past[2]. I'm going to bring it back up the public-test-infra@ mailing list and propose a resolution. Sounds good? [1] http://www.ietf.org/rfc/rfc2119.txt There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for pointing me out this. It sounds like an issue of conformance testing of RFC2119 key word 'should'. The above talk [2] sounds reasonable. However, it is a little different from the coverage tool, that you proposed 4 tests per RFC2119 key word ('must' and 'should') by default :) It is good to find out a resolution around this, thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hehe. Good catch. :) Let's seek to get consensus on this in the mailing list[3] and apply the decision consistently. My personal preference would be to mark optional tests with meta-data but still include them in the repo. [3] http://lists.w3.org/Archives/Public/public-test-infra/2013JulSep/0240.html |
||
<li>if there is a way to disable the audio record, and</li> | ||
<li>if there is a way to stop the video capture.</li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't normative either, afaik. These are QoI issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the spec says nothing about how to stop (here I mean quit) the media capture. But as a complete test, tester should find a way. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tobie, looking back to the spec, I find below statement. Could you please review this again? Many thanks. [[ As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right. Same issue with SHOULD vs MUST here though. Let's try to find a resolution around this. |
||
</ol> | ||
|
||
<input type='file' accept='video/*' capture> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='utf-8'> | ||
<title>HTML Media Capture IDL tests</title> | ||
<link rel='author' title='Intel' href='http://www.intel.com/'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#conformance'> | ||
<link rel='help' href='http://www.w3.org/TR/html-media-capture/#the-capture-attribute'> | ||
<script src='/resources/testharness.js'></script> | ||
<script src='/resources/testharnessreport.js'></script> | ||
<script src='/resources/WebIDLParser.js'></script> | ||
<script src='/resources/idlharness.js'></script> | ||
</head> | ||
<body> | ||
<h1>HTML Media Capture IDL tests</h1> | ||
<div id='log'></div> | ||
|
||
<pre id='untested_idl' style='display:none'> | ||
interface HTMLInputElement { | ||
}; | ||
interface HTMLElement { | ||
}; | ||
interface Element{ | ||
}; | ||
</pre> | ||
|
||
<pre id='idl' style='display:none'> | ||
partial interface HTMLInputElement { | ||
attribute boolean capture; | ||
}; | ||
</pre> | ||
|
||
<form style='display:none'> | ||
<input id='testElement' type='file' accept='image/*' capture> | ||
</form> | ||
|
||
<script> | ||
(function() { | ||
var idl_array = new IdlArray(); | ||
|
||
idl_array.add_untested_idls(document.getElementById('untested_idl').textContent); | ||
idl_array.add_idls(document.getElementById('idl').textContent); | ||
|
||
var testElement = document.getElementById('testElement'); | ||
idl_array.add_objects({HTMLInputElement: [testElement]}); | ||
idl_array.test(); | ||
})(); | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the intention is to perform this test on all input elements, querySelectorAll should be used instead.