Bug 1291312 - Update web-platform-tests to revision 7a6a5c9f436730f86123e6f48a44bf1b7ba5654f, a=testonly

MozReview-Commit-ID: 2Z26QRXPNuK


--HG--
rename : testing/web-platform/tests/encrypted-media/Google/test-encrypted-different-av-keys.webm => testing/web-platform/tests/encrypted-media/Google/webm/test-encrypted-different-av-keys.webm
rename : testing/web-platform/tests/encrypted-media/Google/test-encrypted.webm => testing/web-platform/tests/encrypted-media/Google/webm/test-encrypted.webm
rename : testing/web-platform/tests/web-animations/timing-model/timelines/default-document-timeline.html => testing/web-platform/tests/web-animations/interfaces/AnimationTimeline/document-timeline.html
rename : testing/web-platform/tests/web-animations/interfaces/DocumentTimeline/idlharness.html => testing/web-platform/tests/web-animations/interfaces/AnimationTimeline/idlharness.html
This commit is contained in:
James Graham 2016-08-01 16:46:47 +01:00
Родитель ceb53d0f42
Коммит fbfa130f30
266 изменённых файлов: 8859 добавлений и 1919 удалений

Просмотреть файл

@ -97,6 +97,14 @@
"path": "XMLHttpRequest/send-authentication-prompt-manual.htm",
"url": "/XMLHttpRequest/send-authentication-prompt-manual.htm"
},
{
"path": "annotation-model/examples/example1-manual.html",
"url": "/annotation-model/examples/example1-manual.html"
},
{
"path": "annotation-model/examples/example2-manual.html",
"url": "/annotation-model/examples/example2-manual.html"
},
{
"path": "battery-status/battery-charging-manual.html",
"url": "/battery-status/battery-charging-manual.html"
@ -930,8 +938,8 @@
"url": "/page-visibility/test_tab_state_change-manual.html"
},
{
"path": "pointerevents/pointerevent_button_attribute_mouse-manual.html",
"url": "/pointerevents/pointerevent_button_attribute_mouse-manual.html"
"path": "pointerevents/pointerevent_attributes_mouse-manual.html",
"url": "/pointerevents/pointerevent_attributes_mouse-manual.html"
},
{
"path": "pointerevents/pointerevent_capture_mouse-manual.html",
@ -957,6 +965,14 @@
"path": "pointerevents/pointerevent_lostpointercapture_is_first-manual.html",
"url": "/pointerevents/pointerevent_lostpointercapture_is_first-manual.html"
},
{
"path": "pointerevents/pointerevent_multiple_primary_pointers_boundary_events-manual.html",
"url": "/pointerevents/pointerevent_multiple_primary_pointers_boundary_events-manual.html"
},
{
"path": "pointerevents/pointerevent_pointerId_scope-manual.html",
"url": "/pointerevents/pointerevent_pointerId_scope-manual.html"
},
{
"path": "pointerevents/pointerevent_pointercancel_touch-manual.html",
"url": "/pointerevents/pointerevent_pointercancel_touch-manual.html"
@ -1069,10 +1085,6 @@
"path": "pointerevents/pointerevent_pointerup_pointertype-manual.html",
"url": "/pointerevents/pointerevent_pointerup_pointertype-manual.html"
},
{
"path": "pointerevents/pointerevent_properties_mouse-manual.html",
"url": "/pointerevents/pointerevent_properties_mouse-manual.html"
},
{
"path": "pointerevents/pointerevent_releasepointercapture_events_to_original_target-manual.html",
"url": "/pointerevents/pointerevent_releasepointercapture_events_to_original_target-manual.html"
@ -9053,6 +9065,10 @@
"path": "2dcontext/drawing-text-to-the-canvas/2d.text.draw.baseline.alphabetic.html",
"url": "/2dcontext/drawing-text-to-the-canvas/2d.text.draw.baseline.alphabetic.html"
},
{
"path": "2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.maxWidth.NaN.html",
"url": "/2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.maxWidth.NaN.html"
},
{
"path": "2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.maxWidth.bound.html",
"url": "/2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.maxWidth.bound.html"
@ -12530,12 +12546,12 @@
"url": "/XMLHttpRequest/FormData-append.html"
},
{
"path": "XMLHttpRequest/XMLHttpRequest-withCredentials.html",
"url": "/XMLHttpRequest/XMLHttpRequest-withCredentials.html"
"path": "XMLHttpRequest/XMLHttpRequest-withCredentials.any.js",
"url": "/XMLHttpRequest/XMLHttpRequest-withCredentials.any.html"
},
{
"path": "XMLHttpRequest/XMLHttpRequest-withCredentials.worker.js",
"url": "/XMLHttpRequest/XMLHttpRequest-withCredentials.worker"
"path": "XMLHttpRequest/XMLHttpRequest-withCredentials.any.js",
"url": "/XMLHttpRequest/XMLHttpRequest-withCredentials.any.worker"
},
{
"path": "XMLHttpRequest/abort-after-receive.htm",
@ -12709,6 +12725,10 @@
"path": "XMLHttpRequest/getresponseheader-unsent-opened-state.htm",
"url": "/XMLHttpRequest/getresponseheader-unsent-opened-state.htm"
},
{
"path": "XMLHttpRequest/headers-normalize-response.htm",
"url": "/XMLHttpRequest/headers-normalize-response.htm"
},
{
"path": "XMLHttpRequest/interfaces.html",
"url": "/XMLHttpRequest/interfaces.html"
@ -12997,6 +13017,10 @@
"path": "XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred.htm",
"url": "/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred.htm"
},
{
"path": "XMLHttpRequest/send-blob-with-no-mime-type.html",
"url": "/XMLHttpRequest/send-blob-with-no-mime-type.html"
},
{
"path": "XMLHttpRequest/send-conditional.htm",
"url": "/XMLHttpRequest/send-conditional.htm"
@ -14321,6 +14345,10 @@
"path": "dom/collections/namednodemap-supported-property-names.html",
"url": "/dom/collections/namednodemap-supported-property-names.html"
},
{
"path": "dom/events/AddEventListenerOptions-once.html",
"url": "/dom/events/AddEventListenerOptions-once.html"
},
{
"path": "dom/events/AddEventListenerOptions-passive.html",
"url": "/dom/events/AddEventListenerOptions-passive.html"
@ -14473,6 +14501,10 @@
"path": "dom/lists/DOMTokenList-coverage-for-attributes.html",
"url": "/dom/lists/DOMTokenList-coverage-for-attributes.html"
},
{
"path": "dom/lists/DOMTokenList-iteration.html",
"url": "/dom/lists/DOMTokenList-iteration.html"
},
{
"path": "dom/lists/DOMTokenList-stringifier.html",
"url": "/dom/lists/DOMTokenList-stringifier.html"
@ -15549,6 +15581,162 @@
"path": "encoding/textencoder-utf16-surrogates.html",
"url": "/encoding/textencoder-utf16-surrogates.html"
},
{
"path": "encrypted-media/Google/encrypted-media-async-creation-with-gc.html",
"url": "/encrypted-media/Google/encrypted-media-async-creation-with-gc.html"
},
{
"path": "encrypted-media/Google/encrypted-media-async-setcert-with-gc.html",
"url": "/encrypted-media/Google/encrypted-media-async-setcert-with-gc.html"
},
{
"path": "encrypted-media/Google/encrypted-media-check-init-data-type.html",
"url": "/encrypted-media/Google/encrypted-media-check-init-data-type.html"
},
{
"path": "encrypted-media/Google/encrypted-media-clear-key-invalid-license.html",
"url": "/encrypted-media/Google/encrypted-media-clear-key-invalid-license.html"
},
{
"path": "encrypted-media/Google/encrypted-media-clearkey-update-non-ascii-input.html",
"url": "/encrypted-media/Google/encrypted-media-clearkey-update-non-ascii-input.html"
},
{
"path": "encrypted-media/Google/encrypted-media-events.html",
"url": "/encrypted-media/Google/encrypted-media-events.html"
},
{
"path": "encrypted-media/Google/encrypted-media-generate-request-disallowed-input.html",
"url": "/encrypted-media/Google/encrypted-media-generate-request-disallowed-input.html"
},
{
"path": "encrypted-media/Google/encrypted-media-keystatuses-multiple-sessions.html",
"url": "/encrypted-media/Google/encrypted-media-keystatuses-multiple-sessions.html"
},
{
"path": "encrypted-media/Google/encrypted-media-keystatuses-multiple-updates.html",
"url": "/encrypted-media/Google/encrypted-media-keystatuses-multiple-updates.html"
},
{
"path": "encrypted-media/Google/encrypted-media-keystatuses.html",
"url": "/encrypted-media/Google/encrypted-media-keystatuses.html"
},
{
"path": "encrypted-media/Google/encrypted-media-lifetime-mediakeys-with-session.html",
"url": "/encrypted-media/Google/encrypted-media-lifetime-mediakeys-with-session.html"
},
{
"path": "encrypted-media/Google/encrypted-media-lifetime-mediakeys.html",
"url": "/encrypted-media/Google/encrypted-media-lifetime-mediakeys.html"
},
{
"path": "encrypted-media/Google/encrypted-media-lifetime-mediakeysession-reference.html",
"url": "/encrypted-media/Google/encrypted-media-lifetime-mediakeysession-reference.html"
},
{
"path": "encrypted-media/Google/encrypted-media-lifetime-mediakeysession-release-noreference.html",
"url": "/encrypted-media/Google/encrypted-media-lifetime-mediakeysession-release-noreference.html"
},
{
"path": "encrypted-media/Google/encrypted-media-lifetime-mediakeysession-release.html",
"url": "/encrypted-media/Google/encrypted-media-lifetime-mediakeysession-release.html"
},
{
"path": "encrypted-media/Google/encrypted-media-lifetime-multiple-mediakeys.html",
"url": "/encrypted-media/Google/encrypted-media-lifetime-multiple-mediakeys.html"
},
{
"path": "encrypted-media/Google/encrypted-media-lifetime-reload.html",
"url": "/encrypted-media/Google/encrypted-media-lifetime-reload.html"
},
{
"path": "encrypted-media/Google/encrypted-media-not-callable-after-createsession.html",
"url": "/encrypted-media/Google/encrypted-media-not-callable-after-createsession.html"
},
{
"path": "encrypted-media/Google/encrypted-media-onencrypted.html",
"url": "/encrypted-media/Google/encrypted-media-onencrypted.html"
},
{
"path": "encrypted-media/Google/encrypted-media-playback-encrypted-and-clear-sources.html",
"url": "/encrypted-media/Google/encrypted-media-playback-encrypted-and-clear-sources.html"
},
{
"path": "encrypted-media/Google/encrypted-media-playback-multiple-sessions.html",
"url": "/encrypted-media/Google/encrypted-media-playback-multiple-sessions.html"
},
{
"path": "encrypted-media/Google/encrypted-media-playback-setmediakeys-after-src.html",
"url": "/encrypted-media/Google/encrypted-media-playback-setmediakeys-after-src.html"
},
{
"path": "encrypted-media/Google/encrypted-media-playback-setmediakeys-before-src.html",
"url": "/encrypted-media/Google/encrypted-media-playback-setmediakeys-before-src.html"
},
{
"path": "encrypted-media/Google/encrypted-media-playback-two-videos.html",
"url": "/encrypted-media/Google/encrypted-media-playback-two-videos.html"
},
{
"path": "encrypted-media/Google/encrypted-media-requestmediakeysystemaccess.html",
"url": "/encrypted-media/Google/encrypted-media-requestmediakeysystemaccess.html"
},
{
"path": "encrypted-media/Google/encrypted-media-reset-src-after-setmediakeys.html",
"url": "/encrypted-media/Google/encrypted-media-reset-src-after-setmediakeys.html"
},
{
"path": "encrypted-media/Google/encrypted-media-session-closed-event.html",
"url": "/encrypted-media/Google/encrypted-media-session-closed-event.html"
},
{
"path": "encrypted-media/Google/encrypted-media-setmediakeys-again-after-playback.html",
"url": "/encrypted-media/Google/encrypted-media-setmediakeys-again-after-playback.html"
},
{
"path": "encrypted-media/Google/encrypted-media-setmediakeys-again-after-resetting-src.html",
"url": "/encrypted-media/Google/encrypted-media-setmediakeys-again-after-resetting-src.html"
},
{
"path": "encrypted-media/Google/encrypted-media-setmediakeys-at-same-time.html",
"url": "/encrypted-media/Google/encrypted-media-setmediakeys-at-same-time.html"
},
{
"path": "encrypted-media/Google/encrypted-media-setmediakeys-multiple-times-with-different-mediakeys.html",
"url": "/encrypted-media/Google/encrypted-media-setmediakeys-multiple-times-with-different-mediakeys.html"
},
{
"path": "encrypted-media/Google/encrypted-media-setmediakeys-multiple-times-with-the-same-mediakeys.html",
"url": "/encrypted-media/Google/encrypted-media-setmediakeys-multiple-times-with-the-same-mediakeys.html"
},
{
"path": "encrypted-media/Google/encrypted-media-setmediakeys-to-multiple-video-elements.html",
"url": "/encrypted-media/Google/encrypted-media-setmediakeys-to-multiple-video-elements.html"
},
{
"path": "encrypted-media/Google/encrypted-media-setmediakeys.html",
"url": "/encrypted-media/Google/encrypted-media-setmediakeys.html"
},
{
"path": "encrypted-media/Google/encrypted-media-syntax.html",
"url": "/encrypted-media/Google/encrypted-media-syntax.html"
},
{
"path": "encrypted-media/Google/encrypted-media-unique-origin.html",
"url": "/encrypted-media/Google/encrypted-media-unique-origin.html"
},
{
"path": "encrypted-media/Google/encrypted-media-update-disallowed-input.html",
"url": "/encrypted-media/Google/encrypted-media-update-disallowed-input.html"
},
{
"path": "encrypted-media/Google/encrypted-media-waiting-for-a-key.html",
"url": "/encrypted-media/Google/encrypted-media-waiting-for-a-key.html"
},
{
"path": "encrypted-media/idlharness.html",
"url": "/encrypted-media/idlharness.html"
},
{
"path": "eventsource/dedicated-worker/eventsource-close.htm",
"url": "/eventsource/dedicated-worker/eventsource-close.htm"
@ -15813,6 +16001,14 @@
"path": "fetch/api/basic/request-forbidden-headers.html",
"url": "/fetch/api/basic/request-forbidden-headers.html"
},
{
"path": "fetch/api/basic/request-head-worker.html",
"url": "/fetch/api/basic/request-head-worker.html"
},
{
"path": "fetch/api/basic/request-head.html",
"url": "/fetch/api/basic/request-head.html"
},
{
"path": "fetch/api/basic/request-headers-worker.html",
"url": "/fetch/api/basic/request-headers-worker.html"
@ -15821,6 +16017,18 @@
"path": "fetch/api/basic/request-headers.html",
"url": "/fetch/api/basic/request-headers.html"
},
{
"path": "fetch/api/basic/request-referrer.html",
"url": "/fetch/api/basic/request-referrer.html"
},
{
"path": "fetch/api/basic/response-url-worker.html",
"url": "/fetch/api/basic/response-url-worker.html"
},
{
"path": "fetch/api/basic/response-url.html",
"url": "/fetch/api/basic/response-url.html"
},
{
"path": "fetch/api/basic/scheme-about-worker.html",
"url": "/fetch/api/basic/scheme-about-worker.html"
@ -16017,6 +16225,14 @@
"path": "fetch/api/policies/referrer-no-referrer.html",
"url": "/fetch/api/policies/referrer-no-referrer.html"
},
{
"path": "fetch/api/policies/referrer-origin-when-cross-origin-worker.html",
"url": "/fetch/api/policies/referrer-origin-when-cross-origin-worker.html"
},
{
"path": "fetch/api/policies/referrer-origin-when-cross-origin.html",
"url": "/fetch/api/policies/referrer-origin-when-cross-origin.html"
},
{
"path": "fetch/api/policies/referrer-origin-worker.html",
"url": "/fetch/api/policies/referrer-origin-worker.html"
@ -16413,6 +16629,10 @@
"path": "html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit.html",
"url": "/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit.html"
},
{
"path": "html/browsers/browsing-the-web/navigating-across-documents/empty_fragment.html",
"url": "/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment.html"
},
{
"path": "html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html",
"url": "/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html"
@ -17925,6 +18145,10 @@
"path": "html/semantics/document-metadata/the-base-element/base_srcdoc.html",
"url": "/html/semantics/document-metadata/the-base-element/base_srcdoc.html"
},
{
"path": "html/semantics/document-metadata/the-link-element/document-without-browsing-context.html",
"url": "/html/semantics/document-metadata/the-link-element/document-without-browsing-context.html"
},
{
"path": "html/semantics/document-metadata/the-link-element/link-load-event.html",
"url": "/html/semantics/document-metadata/the-link-element/link-load-event.html"
@ -19265,6 +19489,10 @@
"path": "html/semantics/embedded-content/the-img-element/img.complete.html",
"url": "/html/semantics/embedded-content/the-img-element/img.complete.html"
},
{
"path": "html/semantics/embedded-content/the-img-element/invalid-src.html",
"url": "/html/semantics/embedded-content/the-img-element/invalid-src.html"
},
{
"path": "html/semantics/embedded-content/the-img-element/relevant-mutations.html",
"url": "/html/semantics/embedded-content/the-img-element/relevant-mutations.html"
@ -19777,6 +20005,10 @@
"path": "html/semantics/interactive-elements/the-dialog-element/dialog-close.html",
"url": "/html/semantics/interactive-elements/the-dialog-element/dialog-close.html"
},
{
"path": "html/semantics/interactive-elements/the-dialog-element/dialog-open.html",
"url": "/html/semantics/interactive-elements/the-dialog-element/dialog-open.html"
},
{
"path": "html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html",
"url": "/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html"
@ -19865,6 +20097,10 @@
"path": "html/semantics/scripting-1/the-script-element/script-charset-02.html",
"url": "/html/semantics/scripting-1/the-script-element/script-charset-02.html"
},
{
"path": "html/semantics/scripting-1/the-script-element/script-charset-03.html",
"url": "/html/semantics/scripting-1/the-script-element/script-charset-03.html"
},
{
"path": "html/semantics/scripting-1/the-script-element/script-for-event-xhtml.xhtml",
"url": "/html/semantics/scripting-1/the-script-element/script-for-event-xhtml.xhtml"
@ -19889,6 +20125,10 @@
"path": "html/semantics/scripting-1/the-script-element/script-noembed-noframes-iframe.xhtml",
"url": "/html/semantics/scripting-1/the-script-element/script-noembed-noframes-iframe.xhtml"
},
{
"path": "html/semantics/scripting-1/the-script-element/script-not-executed-after-shutdown.html",
"url": "/html/semantics/scripting-1/the-script-element/script-not-executed-after-shutdown.html"
},
{
"path": "html/semantics/scripting-1/the-script-element/script-not-found-not-executed.html",
"url": "/html/semantics/scripting-1/the-script-element/script-not-found-not-executed.html"
@ -20077,6 +20317,10 @@
"path": "html/semantics/tabular-data/the-table-element/insertRow-method-03.html",
"url": "/html/semantics/tabular-data/the-table-element/insertRow-method-03.html"
},
{
"path": "html/semantics/tabular-data/the-table-element/remove-row.html",
"url": "/html/semantics/tabular-data/the-table-element/remove-row.html"
},
{
"path": "html/semantics/tabular-data/the-table-element/tBodies.html",
"url": "/html/semantics/tabular-data/the-table-element/tBodies.html"
@ -23045,6 +23289,14 @@
"path": "pointerevents/pointerevent_pointermove-on-chorded-mouse-button.html",
"url": "/pointerevents/pointerevent_pointermove-on-chorded-mouse-button.html"
},
{
"path": "pointerevents/pointerevent_suppress_compat_events_on_click.html",
"url": "/pointerevents/pointerevent_suppress_compat_events_on_click.html"
},
{
"path": "pointerevents/pointerevent_suppress_compat_events_on_drag_mouse.html",
"url": "/pointerevents/pointerevent_suppress_compat_events_on_drag_mouse.html"
},
{
"path": "pointerevents/pointerevent_touch-action-illegal.html",
"url": "/pointerevents/pointerevent_touch-action-illegal.html"
@ -29149,6 +29401,10 @@
"path": "service-workers/service-worker/activation-after-registration.https.html",
"url": "/service-workers/service-worker/activation-after-registration.https.html"
},
{
"path": "service-workers/service-worker/activation.https.html",
"url": "/service-workers/service-worker/activation.https.html"
},
{
"path": "service-workers/service-worker/active.https.html",
"url": "/service-workers/service-worker/active.https.html"
@ -29165,6 +29421,10 @@
"path": "service-workers/service-worker/claim-using-registration.https.html",
"url": "/service-workers/service-worker/claim-using-registration.https.html"
},
{
"path": "service-workers/service-worker/client-navigate.https.html",
"url": "/service-workers/service-worker/client-navigate.https.html"
},
{
"path": "service-workers/service-worker/clients-get-cross-origin.https.html",
"url": "/service-workers/service-worker/clients-get-cross-origin.https.html"
@ -29185,6 +29445,10 @@
"path": "service-workers/service-worker/clients-matchall.https.html",
"url": "/service-workers/service-worker/clients-matchall.https.html"
},
{
"path": "service-workers/service-worker/controller-on-disconnect.https.html",
"url": "/service-workers/service-worker/controller-on-disconnect.https.html"
},
{
"path": "service-workers/service-worker/controller-on-load.https.html",
"url": "/service-workers/service-worker/controller-on-load.https.html"
@ -29753,22 +30017,6 @@
"path": "shadow-dom/untriaged/user-interaction/editing/inheritance-of-content-editable-001.html",
"url": "/shadow-dom/untriaged/user-interaction/editing/inheritance-of-content-editable-001.html"
},
{
"path": "shadow-dom/untriaged/user-interaction/focus-navigation/test-001.html",
"url": "/shadow-dom/untriaged/user-interaction/focus-navigation/test-001.html"
},
{
"path": "shadow-dom/untriaged/user-interaction/focus-navigation/test-002.html",
"url": "/shadow-dom/untriaged/user-interaction/focus-navigation/test-002.html"
},
{
"path": "shadow-dom/untriaged/user-interaction/focus-navigation/test-003.html",
"url": "/shadow-dom/untriaged/user-interaction/focus-navigation/test-003.html"
},
{
"path": "shadow-dom/untriaged/user-interaction/focus-navigation/test-004.html",
"url": "/shadow-dom/untriaged/user-interaction/focus-navigation/test-004.html"
},
{
"path": "shadow-dom/untriaged/user-interaction/ranges-and-selections/test-001.html",
"url": "/shadow-dom/untriaged/user-interaction/ranges-and-selections/test-001.html"
@ -30265,6 +30513,10 @@
"path": "webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html",
"url": "/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html"
},
{
"path": "webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html",
"url": "/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html"
},
{
"path": "webdriver/interface.html",
"url": "/webdriver/interface.html"
@ -34998,8 +35250,8 @@
"url": "/workers/constructors/Worker/Blob-url.html"
},
{
"path": "workers/constructors/Worker/DedicatedWorkerGlobalScope-members.html",
"url": "/workers/constructors/Worker/DedicatedWorkerGlobalScope-members.html"
"path": "workers/constructors/Worker/DedicatedWorkerGlobalScope-members.worker.js",
"url": "/workers/constructors/Worker/DedicatedWorkerGlobalScope-members.worker"
},
{
"path": "workers/constructors/Worker/ctor-1.html",
@ -35014,8 +35266,8 @@
"url": "/workers/constructors/Worker/ctor-undefined.html"
},
{
"path": "workers/constructors/Worker/expected-self-properties.html",
"url": "/workers/constructors/Worker/expected-self-properties.html"
"path": "workers/constructors/Worker/expected-self-properties.worker.js",
"url": "/workers/constructors/Worker/expected-self-properties.worker"
},
{
"path": "workers/constructors/Worker/no-arguments-ctor.html",
@ -35034,8 +35286,8 @@
"url": "/workers/constructors/Worker/terminate.html"
},
{
"path": "workers/constructors/Worker/unexpected-self-properties.html",
"url": "/workers/constructors/Worker/unexpected-self-properties.html"
"path": "workers/constructors/Worker/unexpected-self-properties.worker.js",
"url": "/workers/constructors/Worker/unexpected-self-properties.worker"
},
{
"path": "workers/constructors/Worker/unresolvable-url.html",
@ -35856,6 +36108,131 @@
"timeout": "long",
"url": "/encoding/single-byte-decoder.html"
},
{
"path": "encrypted-media/clearkey-check-initdata-type.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-check-initdata-type.html"
},
{
"path": "encrypted-media/clearkey-events.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-events.html"
},
{
"path": "encrypted-media/clearkey-generate-request-disallowed-input.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-generate-request-disallowed-input.html"
},
{
"path": "encrypted-media/clearkey-keystatuses-multiple-sessions.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-keystatuses-multiple-sessions.html"
},
{
"path": "encrypted-media/clearkey-mp4-playback-persistent-usage-record-events.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-mp4-playback-persistent-usage-record-events.html"
},
{
"path": "encrypted-media/clearkey-mp4-playback-persistent-usage-record.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-mp4-playback-persistent-usage-record.html"
},
{
"path": "encrypted-media/clearkey-mp4-playback-retrieve-persistent-usage-record.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-mp4-playback-retrieve-persistent-usage-record.html"
},
{
"path": "encrypted-media/clearkey-mp4-playback-temporary-events.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-mp4-playback-temporary-events.html"
},
{
"path": "encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-mp4-playback-temporary-multikey-sequential.html"
},
{
"path": "encrypted-media/clearkey-mp4-playback-temporary-multikey.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-mp4-playback-temporary-multikey.html"
},
{
"path": "encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-first.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-mp4-playback-temporary-setMediaKeys-first.html"
},
{
"path": "encrypted-media/clearkey-mp4-playback-temporary-two-videos.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-mp4-playback-temporary-two-videos.html"
},
{
"path": "encrypted-media/clearkey-mp4-playback-temporary.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-mp4-playback-temporary.html"
},
{
"path": "encrypted-media/clearkey-not-callable-after-createsession.html",
"timeout": "long",
"url": "/encrypted-media/clearkey-not-callable-after-createsession.html"
},
{
"path": "encrypted-media/drm-check-initdata-type.html",
"timeout": "long",
"url": "/encrypted-media/drm-check-initdata-type.html"
},
{
"path": "encrypted-media/drm-events.html",
"timeout": "long",
"url": "/encrypted-media/drm-events.html"
},
{
"path": "encrypted-media/drm-generate-request-disallowed-input.html",
"timeout": "long",
"url": "/encrypted-media/drm-generate-request-disallowed-input.html"
},
{
"path": "encrypted-media/drm-keystatuses-multiple-sessions.html",
"timeout": "long",
"url": "/encrypted-media/drm-keystatuses-multiple-sessions.html"
},
{
"path": "encrypted-media/drm-mp4-playback-temporary-events.html",
"timeout": "long",
"url": "/encrypted-media/drm-mp4-playback-temporary-events.html"
},
{
"path": "encrypted-media/drm-mp4-playback-temporary-multikey-sequential.html",
"timeout": "long",
"url": "/encrypted-media/drm-mp4-playback-temporary-multikey-sequential.html"
},
{
"path": "encrypted-media/drm-mp4-playback-temporary-multikey.html",
"timeout": "long",
"url": "/encrypted-media/drm-mp4-playback-temporary-multikey.html"
},
{
"path": "encrypted-media/drm-mp4-playback-temporary-setMediaKeys-first.html",
"timeout": "long",
"url": "/encrypted-media/drm-mp4-playback-temporary-setMediaKeys-first.html"
},
{
"path": "encrypted-media/drm-mp4-playback-temporary-two-videos.html",
"timeout": "long",
"url": "/encrypted-media/drm-mp4-playback-temporary-two-videos.html"
},
{
"path": "encrypted-media/drm-mp4-playback-temporary.html",
"timeout": "long",
"url": "/encrypted-media/drm-mp4-playback-temporary.html"
},
{
"path": "encrypted-media/drm-not-callable-after-createsession.html",
"timeout": "long",
"url": "/encrypted-media/drm-not-callable-after-createsession.html"
},
{
"path": "eventsource/dedicated-worker/eventsource-constructor-non-same-origin.htm",
"timeout": "long",
@ -37169,10 +37546,7 @@
]
},
"local_changes": {
"deleted": [
"web-animations/interfaces/AnimationTimeline/idlharness.html",
"web-animations/interfaces/AnimationTimeline/document-timeline.html"
],
"deleted": [],
"deleted_reftests": {},
"items": {
"reftest": {
@ -37232,86 +37606,6 @@
"url": "/html/semantics/forms/the-form-element/form-submission-sandbox.html"
}
]
},
"testharness": {
"2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.maxWidth.NaN.html": [
{
"path": "2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.maxWidth.NaN.html",
"url": "/2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.maxWidth.NaN.html"
}
],
"XMLHttpRequest/headers-normalize-response.htm": [
{
"path": "XMLHttpRequest/headers-normalize-response.htm",
"url": "/XMLHttpRequest/headers-normalize-response.htm"
}
],
"dom/events/AddEventListenerOptions-once.html": [
{
"path": "dom/events/AddEventListenerOptions-once.html",
"url": "/dom/events/AddEventListenerOptions-once.html"
}
],
"dom/lists/DOMTokenList-iteration.html": [
{
"path": "dom/lists/DOMTokenList-iteration.html",
"url": "/dom/lists/DOMTokenList-iteration.html"
}
],
"fetch/api/basic/request-referrer.html": [
{
"path": "fetch/api/basic/request-referrer.html",
"url": "/fetch/api/basic/request-referrer.html"
}
],
"fetch/api/policies/referrer-origin-when-cross-origin-worker.html": [
{
"path": "fetch/api/policies/referrer-origin-when-cross-origin-worker.html",
"url": "/fetch/api/policies/referrer-origin-when-cross-origin-worker.html"
}
],
"fetch/api/policies/referrer-origin-when-cross-origin.html": [
{
"path": "fetch/api/policies/referrer-origin-when-cross-origin.html",
"url": "/fetch/api/policies/referrer-origin-when-cross-origin.html"
}
],
"service-workers/service-worker/activation.https.html": [
{
"path": "service-workers/service-worker/activation.https.html",
"url": "/service-workers/service-worker/activation.https.html"
}
],
"service-workers/service-worker/client-navigate.https.html": [
{
"path": "service-workers/service-worker/client-navigate.https.html",
"url": "/service-workers/service-worker/client-navigate.https.html"
}
],
"service-workers/service-worker/controller-on-disconnect.https.html": [
{
"path": "service-workers/service-worker/controller-on-disconnect.https.html",
"url": "/service-workers/service-worker/controller-on-disconnect.https.html"
}
],
"web-animations/interfaces/DocumentTimeline/idlharness.html": [
{
"path": "web-animations/interfaces/DocumentTimeline/idlharness.html",
"url": "/web-animations/interfaces/DocumentTimeline/idlharness.html"
}
],
"web-animations/timing-model/timelines/default-document-timeline.html": [
{
"path": "web-animations/timing-model/timelines/default-document-timeline.html",
"url": "/web-animations/timing-model/timelines/default-document-timeline.html"
}
],
"webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html": [
{
"path": "webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html",
"url": "/webaudio/the-audio-api/the-pannernode-interface/test-pannernode-automation.html"
}
]
}
},
"reftest_nodes": {
@ -43703,7 +43997,7 @@
}
]
},
"rev": "6744ac43d76207bdd1ececa4b91c9bfeef3ad522",
"rev": "7a6a5c9f436730f86123e6f48a44bf1b7ba5654f",
"url_base": "/",
"version": 3
}

Просмотреть файл

@ -1 +1 @@
c16304ae0ddedde913c21f64f7a037311a702c6a
41a1810c95089690ccfc3c1ea48b2ee82cd725b0

Просмотреть файл

@ -128,18 +128,18 @@ if len(sys.argv) > 1 and sys.argv[1] == '--test':
doctest.testmod()
sys.exit()
templates = yaml.load(open('templates.yaml').read())
name_mapping = yaml.load(open('name2dir.yaml').read())
templates = yaml.load(open('templates.yaml', "r").read())
name_mapping = yaml.load(open('name2dir.yaml', "r").read())
spec_assertions = []
for s in yaml.load(open('spec.yaml').read())['assertions']:
for s in yaml.load(open('spec.yaml', "r").read())['assertions']:
if 'meta' in s:
eval(compile(s['meta'], '<meta spec assertion>', 'exec'), {}, {'assertions':spec_assertions})
else:
spec_assertions.append(s)
tests = []
for t in sum([ yaml.load(open(f).read()) for f in ['tests.yaml', 'tests2d.yaml', 'tests2dtext.yaml']], []):
for t in sum([ yaml.load(open(f, "r").read()) for f in ['tests.yaml', 'tests2d.yaml', 'tests2dtext.yaml']], []):
if 'DISABLED' in t:
continue
if 'meta' in t:
@ -543,7 +543,7 @@ def write_results():
if not os.path.exists('results.yaml'):
print "Can't find results.yaml"
else:
for resultset in yaml.load(open('results.yaml').read()):
for resultset in yaml.load(open('results.yaml', "r").read()):
#title = "%s (%s)" % (resultset['ua'], resultset['time'])
title = resultset['name']
#assert title not in uas # don't allow repetitions

Просмотреть файл

@ -9,7 +9,7 @@ import html5lib.treebuilders.dom
def extract():
parser = html5lib.html5parser.HTMLParser(tree=html5lib.treebuilders.dom.TreeBuilder)
doc = parser.parse(open('current-work'), encoding='utf-8')
doc = parser.parse(open('current-work', "r"), encoding='utf-8')
head = doc.getElementsByTagName('head')[0]
for n in head.childNodes:

Просмотреть файл

@ -79,3 +79,13 @@ partial interface URL {
static void revokeObjectURL(DOMString url);
};
[Constructor, Exposed=Worker]
interface FileReaderSync {
// Synchronously return strings
ArrayBuffer readAsArrayBuffer(Blob blob);
DOMString readAsText(Blob blob, optional DOMString label);
DOMString readAsDataURL(Blob blob);
};

Просмотреть файл

@ -18,20 +18,7 @@ request.onload = function() {
idl_array.add_untested_idls("[TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event);");
idl_array.add_untested_idls("typedef EventHandlerNonNull? EventHandler;");
var worker_idls =
'[Constructor, Exposed=Worker]\n' +
'interface FileReaderSync {\n' +
'\n' +
' // Synchronously return strings\n' +
'\n' +
' ArrayBuffer readAsArrayBuffer(Blob blob);\n' +
' DOMString readAsText(Blob blob, optional DOMString label);\n' +
' DOMString readAsDataURL(Blob blob);\n' +
'};';
idl_array.add_idls(idls);
idl_array.add_idls(worker_idls);
idl_array.add_objects({
Blob: ['new Blob(["TEST"])'],

Просмотреть файл

@ -108,7 +108,7 @@ function run_test() {
.then(function(result) {
assert_unreached("digest() should not have worked for " + alg + ":" + size);
}, function(err) {
assert_equals(err.message, "OperationError", "Bad algorithm name should cause OperationError")
assert_equals(err.name, "NotSupportedError", "Bad algorithm name should cause NotSupportedError")
});
return promise;

Просмотреть файл

@ -0,0 +1,40 @@
test(function() {
var client = new XMLHttpRequest()
assert_false(client.withCredentials, "withCredentials defaults to false")
client.withCredentials = true
assert_true(client.withCredentials, "is true after setting")
}, "default value is false, set value is true")
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/delay.py?ms=1000", true)
client.withCredentials = true
assert_true(client.withCredentials, "set in OPEN state")
}, "can also be set in OPEN state")
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/delay.py?ms=1000", false)
client.withCredentials = true
assert_true(client.withCredentials, "set in OPEN state")
}, "setting on synchronous XHR")
async_test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/delay.py?ms=1000")
client.send()
assert_throws("InvalidStateError", function() { client.withCredentials = true })
client.onreadystatechange = this.step_func(function() {
assert_throws("InvalidStateError", function() { client.withCredentials = true })
if (client.readyState === 4) {
this.done()
}
})
}, "setting withCredentials when not in UNSENT, OPENED state (asynchronous)")
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/delay.py?ms=1000", false)
client.send();
assert_throws("InvalidStateError", function() { client.withCredentials = true })
}, "setting withCredentials when in DONE state (synchronous)")

Просмотреть файл

@ -1,13 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<title>XMLHttpRequest#withCredentials</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src=XMLHttpRequest-withCredentials.js></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-withcredentials-attribute"
data-tested-assertations="following::ol/li[1] following::ol/li[2]
following::ol/li[3] following::ol/li[4]">
<div id="log"></div>
<script>
test_withCredentials(false)
</script>

Просмотреть файл

@ -1,42 +0,0 @@
function test_withCredentials(worker) {
test(function() {
var client = new XMLHttpRequest()
assert_false(client.withCredentials, "withCredentials defaults to false")
client.withCredentials = true
assert_true(client.withCredentials, "is true after setting")
}, "default value is false, set value is true")
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/delay.py?ms=1000", true)
client.withCredentials = true
assert_true(client.withCredentials, "set in OPEN state")
}, "can also be set in OPEN state")
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/delay.py?ms=1000", false)
client.withCredentials = true
assert_true(client.withCredentials, "set in OPEN state")
}, "setting on synchronous XHR")
async_test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/delay.py?ms=1000")
client.send()
assert_throws("InvalidStateError", function() { client.withCredentials = true })
client.onreadystatechange = this.step_func(function() {
assert_throws("InvalidStateError", function() { client.withCredentials = true })
if (client.readyState === 4) {
this.done()
}
})
}, "setting withCredentials when not in UNSENT, OPENED state (asynchronous)")
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "resources/delay.py?ms=1000", false)
client.send();
assert_throws("InvalidStateError", function() { client.withCredentials = true })
}, "setting withCredentials when in DONE state (synchronous)")
}

Просмотреть файл

@ -1,4 +0,0 @@
importScripts("/resources/testharness.js")
importScripts("XMLHttpRequest-withCredentials.js")
test_withCredentials(true);
done()

Просмотреть файл

@ -15,9 +15,10 @@
var client = new self[0].XMLHttpRequest()
client.onreadystatechange = function() {
test.step(function() {
if(client.readyState == 4)
if(client.readyState == 4) {
assert_equals(client.responseText, "bottom\n")
test.done()
}
})
}
client.open("GET", "folder.txt")

Просмотреть файл

@ -4,4 +4,4 @@ def main(request, response):
srcmoddt = datetime.datetime.fromtimestamp(os.path.getmtime(srcpath))
response.headers.set("Last-Modified", srcmoddt.strftime("%a, %d %b %Y %H:%M:%S GMT"))
response.headers.set("Content-Type", "application/xml")
return open(srcpath).read()
return open(srcpath, "r").read()

Просмотреть файл

@ -19,7 +19,7 @@
assert_equals(client.responseXML.documentElement.localName, "html", 'localName is html')
assert_equals(client.responseXML.documentElement.childNodes.length, 5, 'childNodes is 5')
assert_equals(client.responseXML.getElementById("n1").localName, client.responseXML.documentElement.childNodes[1].localName)
assert_equals(client.responseXML.getElementById("n2"), null, 'getElementById("n2")')
assert_equals(client.responseXML.getElementById("n2"), client.responseXML.documentElement.childrenNodes[3], 'getElementById("n2")')
assert_equals(client.responseXML.getElementsByTagName("p")[1].namespaceURI, "namespacesarejuststrings", 'namespaceURI')
})
test(function() {

Просмотреть файл

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[4]/dl[1]/dd[2]/p[3]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol[1]/li[3]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetype-attribute" data-tested-assertations="following::ol[1]/li[4]"/>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::a[contains(@href,'#blob-response-entity-body')]/.."/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<title>XMLHttpRequest: The send() method: Blob data with no mime type</title>
</head>
<body>
<div id="log"></div>
<script type="text/javascript">
var blobTests = [
["no mime type", new Blob(["data"])],
["invalid mime type", new Blob(["data"], {type: "Invalid \r\n mime \r\n type"})]
];
blobTests.forEach(function(item){
test(function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "./resources/content.py", false);
xhr.send(item[1]);
assert_equals(xhr.getResponseHeader("X-Request-Content-Length"), "4");
assert_equals(xhr.getResponseHeader("X-Request-Content-Type"), "NO");
}, "Synchronous blob loading with " + item[0]);
var atest = async_test("Asynchronous blob loading with " + item[0]);
atest.step(function() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
atest.step(function() {
assert_equals(xhr.getResponseHeader("X-Request-Content-Length"), "4");
assert_equals(xhr.getResponseHeader("X-Request-Content-Type"), "NO");
});
atest.done();
}
}
xhr.open("POST", "./resources/content.py", true);
xhr.send(item[1]);
});
});
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

Просмотреть файл

@ -0,0 +1,370 @@
Annotation-model: Guidelines for Contributing Tests
===================================================
This document describes the method people should use for authoring tests and
integrating them into the repository. Anyone is welcome to submit new tests to
this collection. If you do, please create the tests following the guidelines
below. Then submit them as a pull request so they can be evaluated
Structure
---------
Tests are organized by major section of the Annotation Model specification. The
folders associated with these are:
* annotations
* bodiesTargets
* collections
* specificResources
* selectors
* states
Within these folders, special files ending with the suffix ".test" provide the source
for the test as a set of declarative assertions about the required shape of the conforming
JSON object. These files are transformed using a test generation tool into ".html" files
that are then accessed by the Web Platform Test framework.
There are a few other folders that provide supporting materials for the tests:
* common - assertionObjects, conditionObjects, and other supporting materials
* definitions - JSON Schema definitions that can be referenced
* scripts - JavaScript that are included by tests
* tools - supporting scripts and files
NOTE: The files in the definitions folder are expected to be JSON Schema
definitions - basically commonly used concepts that are referenced by other JSON
Schema files in the system. All of these 'definitions' are preloaded by the
system before any other parts of a test are processed.
Test Cases
----------
Each test is expressed as a simple (or complex) requirement in a test file.
For each section of the document, the requirement is represented as a structure
that describes the nature of the test, and then includes or references minimal
JSON Schema that test the assertions implied by the requirement.
The structure of a test case is defined using a [JSON-LD
Context](JSONtest-v1.jsonld). That context defines the following terms:
|Keyword | Values | Meaning
|---------------|-----------------|---------
|name | string | The name of this test for display purposes
|description | string | A long self-describing paragraph that explains the purpose of the test and the expected input
|ref | URI | An optional reference to the portion of the specification to which the test relates
|testType | `automated`, `manual`, `ref` | The type of test - this informs [WPT](https://github.com/w3c/web-platform-tests) how the test should be controlled and presented
|assertions | list of URI, List @@@ATRISK@@@, or AssertionObject | The ordered collection of tests the input should be run against. See [JSON Schema Usage](#jsonSchema) for the structure of the objects. URI is relative to the top level folder of the test collection if it has a slash; relative to the current directory if it does not. @@@@ATRISK@@@@ Lists can be nested to define groups of sub-tests. Assertions / groups can be conditionally skipped. See [Assertion Lists](#assertionLists) for more details.
Each test case has a suffix of `.test` and a shape like:
<pre>
{
"@context": "https://www.w3.org/ns/JSONtest-v1.jsonld",
"name": "Verify annotation conforms to the model",
"description": "Supply an example annotation that conforms to the basic structure.",
"ref": "https://www.w3.org/TR/annotation-model/#model",
"testType": "manual",
"assertions": [
"common/has_context.json",
"common/has_id.json",
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Verify annotation has target",
"type": "object",
"expectedResult": "valid",
"errorMessage": "The object was missing a required 'target' property",
"properties": {
"target": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"anyOf": [
{
"type": "string"
}
]
}
],
"not": {"type": "object"}
}
},
"required": ["target"]
}
]
}
</pre>
External references are used when the "assertion" is a common one that needs to
be checked on many different test cases (e.g., that there is an @context in the
supplied annotation).
### <a id="assertionLists">Assertion Lists</a> ###
The `assertion` list is an ordered list of assertions that will be evaluated
against the submitted content. The list is *required*, and MUST have at least
one entry. Entries in the list have the following types:
* AssertionObject
An in-line Object as defined in the section [Assertion
Objects](#assertionObjects).
* URI
A relative or absolute URI that references a AssertionObject in a .json file.
If the URI is relative but contains no slashes, then it is considered to be
in the current directory. If the URI is relative, contains slashes, but
**does not start with a slash** then it is considered relative to the top of
the tree of the current test collection (e.g., `annotation-model`).
* List @@@ATRISK@@@
A nested Assertion List. While nested Assertion Lists are optional, if one
is present it MUST have at least one entry. Entries are as in this list.
Assertion Lists can be nested to any depth (but don't do that - it would be
too hard to maintain).
<a id="assertionObjects">Assertion Objects</a>
-----------------
In this collection of tests, Assertion Objects can be contained inline in the
`.test` files or contained in external files with the suffix `.json`. The
vocabularly and structure is as defined in [JSON Schema
v4](http://json-schema.org/documentation.html) augmented with some additional
properties defined in this section.
In general each JSON Schema definition provided in this test suite should be as
minimal as possible. This promotes clarity and increases the likelihood that
it is correct. While it is ---possible--- to create JSON Schema files that
enforce many different requirements on a data model, it increases the
complexity and can also reduce the atomicity of tests / sub-tests (because a
test ends up testing more than one thing). Please try to avoid creating
complex JSON Schema. (A notable exception is the situation where multiple
properties of a structure are interdependent.)
Tools such as [the JSON Schema Creator](http://jsonschema.net/) may be helpful
in creating schema snippets that can be integrated into JSONtest Assertion
Objects. Remember that the JSON Schema you create should be as permissive as
possible to address the various shapes that a give property might take (e.g., a
'foo' might be a string or an object that contains sub-properties that express
the string, or an array of 1 or more objects with those sub-properties).
In addition to the validation keys defined in JSON Schema v4, Schema files in
this collection are also permitted to use the following keywords:
|Keyword | Values | Meaning |
|---------------|-----------------|---------|
|onUnexpectedResult | `failAndContinue`, `failAndSkip`, `failAndAbort`, `passAndContinue`, `passAndSkip`, `passAndAbort` | Action to take when the result is not as expected. Default is `failAndContinue` |
|assertionType | `must`, `may`, `should` | Informs the system about the severity of a failure. The default is `must` |
|assertionFile | URI | An external file that contains an assertion SCHEMA. When this value is supplied, and local properties will override the ones loaded from the external file.
|errorMessage | string | A human readable explanation of what it means if the test fails. |
|expectedResult | `valid`, `invalid` | Tells the framework whether validating against this schema is expected to succeed or fail. The default is `valid` |
### Example Assertion Object ###
<pre>
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Verify annotation has @context",
"type": "object",
"expectedResult" : "valid",
"properties": {
"@context": {
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"anyOf": [
{
"type": "string"
}
]
}
],
"not": {"type": "object"}
}
},
"required": ["@context"]
}
</pre>
Note that in the case where a feature is *optional* the JSON Schema MUST be
crafted such that if the attribute is permitted to be missing from the content
(so that the result is `true`), but when the attribute is present in the
content it conforms to any requirements.
<a id="conditionObjects">Condition Objects</a>
-----------------
A Condition Object is a sub-class of an Assertion Object. It allows the
specification of the evaluation strategy for the assertions referenced by the
object. An object is a Condition Object IFF it has a `assertions` property. In
this case, there MUST NOT be an `assertionFile` property.
|Keyword | Values | Meaning |
|---------------|-----------------|---------|
|compareWith | `and`, `or` | How should the result of any referenced assertions be compared. Defaults to `and`. Note that this implies there is also an assertions property with a nested list of assertions to compare. |
|assertions | a list of assertions as in a Test Case above. This is required if there is a compareWith property |
An example of a test that would pass if there were an `@context` OR there were an `@id`:
<pre>
{
"@context": "https://www.w3.org/ns/JSONtest-v1.jsonld",
"name": "A test that has an 'or' clause",
"description": "A complex test that uses or-ing among a list of assertions",
"ref": "https://www.w3.org/TR/annotation-model/#model",
"testType": "manual",
"assertions": [
{ "$schema": "http://json-schema.org/draft-04/schema#",
"title": "must have context or id",
"description": "A more complex example that allows one of many options to pass",
"assertions": [
{ "title": "Condition Object",
"description": "A pseudo-test that will get a result from the aggregate of its children",
"assertionType": "must",
"expectedResult": "valid",
"errorMessage": "Error: None of the various options were present",
"compareWith": "or",
"assertions": [
"common/has_context.json",
"common/has_id.json"
]
}
]
}
]
}
</pre>
Command Line Tools
------------------
### Building the Test Files ###
The actual .html test case files are generated using the script
tools/make_tests.py. This script will search the directory heriarchy looking for
files ending on `.test` and creating `.html` files from them using the template in
the tools folder. If you want to regenerate the examples too, supply the
`--examples` option to the script.
Note that when submitting tests to the repository, the `.html` versions must be
included.
### Testing the Tests ###
### Driving Tests with Input Files ###
Complex Examples
----------------
This section is a collection of more complex examples to illustrate the
expressive power of the [Assertion List](#assertionLists) structure. These can
be used as templates for creating actual `.test` files.
### Including and Overriding an Assertion ###
Assertions can be contained in external `.json` files. It is possible for an
object in an Assertion List to include the external file and override one or
more of its properties:
<pre>
{
"@context": "https://www.w3.org/ns/JSONtest-v1.jsonld",
"name": "Permit no target property",
"description": "Ensure there is no 'target' property when there is a 'randomName' property in the Annotation",
"assertions": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Verify annotation has randomName",
"type": "object",
"properties": {
"randomName": {
"type": "string"
}
},
"required": ["randomName"]
},
{ "assertionFile" : "common/target.json",
"title" : "Require target to be missing",
"expectedResult" : "invalid",
"errorMessage" : "The target MUST not be present when 'randomName' is also present",
}
]
}
</pre>
### Nested Assertion Collections with Skip ###
Assertion Lists can be nested within Assertion Lists. This feature, combined
with the `onUnexpectedResult` property, makes it possible to skip a collection
of tests when an assertion in the list is not satisfied:
<pre>
{
"@context": "https://www.w3.org/ns/JSONtest-v1.jsonld",
"name": "If there is no 'target' property, skip some tests",
"description": "When 'target' is not present, other properties related to 'target' are not required",
"assertions": [
"common/context.json",
[
{ "assertionFile" : "common/target.json",
"errorMessage" : "Target was not present so skip the rest of this section",
"onUnexpectedResult" : "failAndSkip"
},
"sometest.json",
"sometest2.json",
"sometest3.json"
]
]
} ;
</pre>
### Assertion that finds a specific @context Value ###
Sometimes you want a property to be flexible, but to have one and only one of a
specific value. This is especially true with, for example, @context in JSON-LD.
One way you might do this is:
<pre>
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Verify a specific @context",
"type": "object",
"expectedResult" : "valid",
"properties": {
"@context": {
"anyOf": [
{
"type": "string"
"enum": [ "http://www.w3.org/ns/anno.jsonld" ]
},
{
"type": "array",
"minitems": "1",
"uniqueItems": true,
"additionalItems": true,
"items" : [
{ "type": "string",
"enum": [ "http://www.w3.org/ns/anno.jsonld" ]
}
]
}
],
"not": {"type": "object"}
}
},
"required": ["@context"]
}
</pre>

Просмотреть файл

@ -0,0 +1,2 @@
@halindrome
@bigbluehat

Просмотреть файл

@ -0,0 +1,81 @@
Annotation-model: Tests for the Web Annotation Data Model
=========================================================
The [Web Annotation Data Model](https://www.w3.org/TR/annotation-model)
specification presents a JSON-oriented collection of terms and structure that
permit the sharing of annotations about other content.
The purpose of these tests is to help validate that each of the structural
requirements expressed in the Data Model specification are properly supported
by implementations.
The general approach for this testing is to enable both manual and automated
testing. However, since the specification has no actual user interface
requirements, there is no general automation mechanism that can be presented
for clients. Instead, the automation mechanism is one where client
implementors could take advantage of the plumbing we provide here to push their
data into the tests and collect the results of the testing. This assumes
knowledge of the requirements of each test / collection of tests so that the
input data is relevant. Each test or test collection contains information
sufficient for the task.
Running Tests
-------------
In the case of this test collection, we will be initially creating manual
tests. These will automatically determine pass or fail and generate output for
the main WPT window. The plan is to minimize the number of such tests to
ease the burden on the testers while still exercising all the features.
The workflow for running these tests is something like:
1. Start up the test driver window and select the annotation-model tests -
click "Start"
2. A window pops up that shows a test - the description of which tells the
tester what input is expected. The window contains a textarea into which
the input can be typed / pasted, along with a button to click to start
testing that input.
3. The tester (presumably in another window) brings up their annotation client
and uses it to generate an annotation that supplies the requested structure.
They then copy / paste that into the aforementioned textarea and select the
button.
4. The test runs. Success or failure is determined and reported to the test
driver window, which then cycles to the next test in the sequence.
5. Repeat steps 2-4 until done.
6. Download the JSON format report of test results, which can then be visually
inspected, reported on using various tools, or passed on to W3C for
evaluation and collection in the Implementation Report via github.
**Remember that while these tests are written to help exercise implementations,
their other (important) purpose is to increase confidence that there are
interoperable implementations.** So, implementers are our audience, but these
tests are not meant to be a comprehensive collection of tests for a client that
might implement the Recommendation. The bulk of the tests are manual because
there are no UI requirements in the Recommendation that would make it possible
to effectively stimulate every client portably.
Having said that, because the structure of these "manual" tests is very rigid,
it is possible for an implementer who understands test automation to use an
open source tool such as [Selenium](http://www.seleniumhq.org/) to run these
"manual" tests against their implementation - exercising their implementation
against content they provide to create annotations and feed the data into our
test input field and run the test.
Capturing and Reporting Results
-------------------------------
As tests are run against implementations, if the results of testing are
submitted to [test-results](https://github.com/w3c/test-results/) then they will
be automatically included in documents generated by
[wptreport](https://www.github.com/w3c/wptreport). The same tool can be used
locally to view reports about recorded results.
Automating Test Execution
-------------------------
Writing Tests
-------------
If you are interested in writing tests for this environment, see the
associated [CONTRIBUTING](CONTRIBUTING.md) document.

Просмотреть файл

@ -0,0 +1,18 @@
Things still to be developed:
Script to run .jsonld files in tools/tests against .test files
Script to batch run submitted .jsonld files from an implementation against .test
files
Websocket communication to runner tests with a corresponding listener that an
implementation could use to auto-submit jsonld into the "manual" tests
Change JSONtest logic so that it loads all of the required external files during
initialization so that it can populate the list of assertions for the HTML in a
manual test. Use Promises and Promise.all() to achieve this.
Add a Skip option to tools/runner
Add a tuple mode for evaluating RDF declaratively as well.

Просмотреть файл

Просмотреть файл

@ -0,0 +1,18 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id" : "choiceSet.json",
"type": "object",
"properties":
{
"type":
{
"type": "string",
"enum": ["Choice", "Composite", "List", "Independents"]
},
"items" :
{
"type" : "array"
}
},
"required": [ "type", "items" ]
}

Просмотреть файл

@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id" : "externalWebResource.json",
"type": "object",
"properties":
{
"id":
{
"$ref": "stringUri.json#"
}
},
"required": [ "id" ]
}

Просмотреть файл

@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id" : "specificResource.json",
"type": "object",
"properties":
{
"source":
{
"type": ["string", "object" ],
"oneOf": [
{ "$ref": "stringUri.json#" },
{ "$ref": "externalWebResource.json#"}
]
}
},
"required": ["source"]
}

Просмотреть файл

@ -0,0 +1,6 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id" : "stringUri.json",
"type": "string",
"format": "uri"
}

Просмотреть файл

@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id" : "textualBody.json",
"type": "object",
"properties":
{
"value":
{
"type": "string"
}
},
"required": [ "value" ]
}

Просмотреть файл

@ -0,0 +1,9 @@
Example Tests
=============
The tests in this folder are examples to show how the framework
should be used. They are NOT intended for conformance testing use, and
tools/make_tests.py will not generate the tests in this folder without the
`--examples` option.

Просмотреть файл

@ -0,0 +1,46 @@
<!doctype html>
<html>
<head>
<title>Verify annotation conforms to the model</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/annotation-model/scripts/ajv.min.js"></script>
<script src="/annotation-model/scripts/JSONtest.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theDefinitions=[
"definitions/specificResource.json",
"definitions/stringUri.json",
"definitions/choiceSet.json",
"definitions/externalWebResource.json",
"definitions/textualBody.json"
];
var theTestFile="example1.test";
var runningTest = new JSONtest( {
"testInput" : "annotation-input",
"runTest" : "annotation-run",
"closeWindow" : "annotation-close",
"schemaDefs" : theDefinitions,
"testFile" : theTestFile
} ) ;
</script>
</head>
<body>
<p>Fill the textarea below with JSON output from your annotation client
implementation that supports the following criteria:</p>
<div id="testDescription"></div>
<p>Specifically, the following assertions will be evaluated:</p>
<div id="assertion"></div>
<form name="annotation" id="annotation">
<textarea name="annotation-input" id="annotation-input" style="width: 90%; height: 10em" >
</textarea>
<p><input type="button" id="annotation-run" name="Loading..." value="Loading...">
<input style="display: none" type="button" id="annotation-close"
name="Close" value="Close"></p>
</form>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
{
"@context": "https://www.w3.org/ns/JSONtest-v1.jsonld",
"name": "Verify annotation conforms to the model",
"description": "Supply an example annotation that conforms to the basic structure.",
"ref": "https://www.w3.org/TR/annotation-model/#model",
"assertions": [
"exampleContext.json",
"exampleTarget.json"
]
}

Просмотреть файл

@ -0,0 +1,46 @@
<!doctype html>
<html>
<head>
<title>A test that has an 'or' clause</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/annotation-model/scripts/ajv.min.js"></script>
<script src="/annotation-model/scripts/JSONtest.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theDefinitions=[
"definitions/specificResource.json",
"definitions/stringUri.json",
"definitions/choiceSet.json",
"definitions/externalWebResource.json",
"definitions/textualBody.json"
];
var theTestFile="example2.test";
var runningTest = new JSONtest( {
"testInput" : "annotation-input",
"runTest" : "annotation-run",
"closeWindow" : "annotation-close",
"schemaDefs" : theDefinitions,
"testFile" : theTestFile
} ) ;
</script>
</head>
<body>
<p>Fill the textarea below with JSON output from your annotation client
implementation that supports the following criteria:</p>
<div id="testDescription"></div>
<p>Specifically, the following assertions will be evaluated:</p>
<div id="assertion"></div>
<form name="annotation" id="annotation">
<textarea name="annotation-input" id="annotation-input" style="width: 90%; height: 10em" >
</textarea>
<p><input type="button" id="annotation-run" name="Loading..." value="Loading...">
<input style="display: none" type="button" id="annotation-close"
name="Close" value="Close"></p>
</form>
</body>
</html>

Просмотреть файл

@ -0,0 +1,42 @@
{
"@context": "https://www.w3.org/ns/JSONtest-v1.jsonld",
"name": "A test that has an 'or' clause",
"description": "This is a complex test that uses or-ing among a list of assertions.",
"ref": "https://www.w3.org/TR/annotation-model/#model",
"testType": "manual",
"assertions":
{ "title": "Condition Object",
"description": "A pseudo-test that will get a result from the aggregate of its children",
"assertionType": "must",
"expectedResult": "valid",
"errorMessage": "Error: None of the various options were present",
"compareWith": "or",
"assertions": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "'The Annotation must have 1 or more @context values' (Section 3.1)",
"assertionType": "must",
"expectedResult": "valid",
"errorMessage": "Error: Annotation does not have an @context property.",
"type": "object",
"properties": {
"@context": {}
},
"required": ["@context"]
},
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "'An Annotation should have exactly 1 id' (Section 3.1)",
"assertionType": "should",
"expectedResult": "valid",
"errorMessage": "Warning: The Annotation is not identified using the id key (Section 3.1).",
"type": "object",
"properties": {
"id": {}
},
"required": ["id"]
}
]
}
}

Просмотреть файл

@ -0,0 +1,31 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Check @context value",
"description": "'http://www.w3.org/ns/anno.jsonld must be' an @context value (Section 3.1)",
"assertionType": "must",
"expectedResult": "valid",
"errorMessage": "Error: 'http://www.w3.org/ns/anno.jsonld' is not an @context value.",
"type": "object",
"properties": {
"@context": {
"oneOf": [
{ "type": "string",
"$ref": "#/definitions/contextValue" },
{ "type": "array",
"$ref": "#/definitions/contextArray" }
]
}
},
"definitions": {
"contextValue":
{ "enum": [ "http://www.w3.org/ns/anno.jsonld" ] },
"contextArray":
{ "not":
{ "items":
{ "not":
{ "type": "string",
"$ref": "#/definitions/contextValue" } }
}
}
}
}

Просмотреть файл

@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Check if target feature implemented",
"description": "'There must be 1 or more target relationships associated with an Annotation.' (Section 3.1)",
"assertionType": "must",
"expectedResult": "valid",
"errorMessage": "Error: Annotation has no target relationships - at least 1 is required. (Section 3.1)",
"type": "object",
"properties": {
"target": { "type": ["string", "array", "object"] }
},
"required": ["target"]
}

Просмотреть файл

@ -0,0 +1,702 @@
/* globals add_completion_callback, Promise, done, assert_true, Ajv, on_event */
/**
* Creates a JSONtest object. If the parameters are supplied
* it also loads a referenced testFile, processes that file, loads any
* referenced external assertions, and sets up event listeners to process the
* user's test data. The loading is done asynchronously via Promises. The test
* button's text is changed to Loading while it is processing, and to "Check
* JSON" once the data is loaded.
*
* @constructor
* @param {object} params
* @param {string} [params.test] - object containing JSON test definition
* @param {string} [params.testFile] - URI of a file with JSON test definition
* @param {string} params.runTest - IDREF of an element that when clicked will run the test
* @param {string} params.testInput - IDREF of an element that contains the JSON(-LD) to evaluate against the assertions in the test / testFile
* @event DOMContentLoaded Calls init once DOM is fully loaded
* @returns {object} Reference to the new object
*/
function JSONtest(params) {
'use strict';
this.Assertions = []; // object that will contain the assertions to process
this.AssertionText = ""; // string that holds the titles of all the assertions in use
this.DescriptionText = "";
this.Base = null; // URI "base" for the test suite being run
this.TestDir = null; // URI "base" for the test case being run
this.Params = null; // paramaters passed in
this.Properties = null; // testharness_properties from the opening window
this.Test = null; // test being run
this.AssertionCounter = 0;// keeps track of which assertion is being processed
this._assertionText = []; // Array of text or nested arrays of assertions
this._assertionCache = [];// Array to put loaded assertions into
this._loading = true;
var pending = [] ;
// set up in case DOM finishes loading early
pending.push(new Promise(function(resolve) {
on_event(document, "DOMContentLoaded", function() {
resolve(true);
}.bind(this));
}.bind(this)));
// create an ajv object that will stay around so that caching
// of schema that are compiled just works
this.ajv = new Ajv({allErrors: true, validateSchema: false}) ;
// determine the base URI for the test collection. This is
// the top level folder in the test "document.location"
var l = document.location;
var p = l.pathname;
this.TestDir = p.substr(0, 1+p.lastIndexOf('/'));
this.Base = p.substr(0, 1+p.indexOf('/', 1));
// if we are under runner, then there are props in the parent window
//
// if "output" is set in that, then pause at the end of running so the output
// can be analyzed. @@@TODO@@@
if (window && window.opener && window.opener.testharness_properties) {
this.Properties = window.opener.testharness_properties;
}
this.Params = params;
// if there is a list of definitions in the params,
// include them
if (this.Params.schemaDefs) {
var defPromise = new Promise(function(resolve, reject) {
var promisedSchema = this.Params.schemaDefs.map(function(item) {
return this.loadDefinition(item);
}.bind(this));
// Once all the loadAssertion promises resolve...
Promise.all(promisedSchema)
.then(function (schemaContents) {
this.ajv.addSchema(schemaContents);
resolve(true);
}.bind(this))
.catch(function(err) {
reject(err);
}.bind(this));
}.bind(this));
// these schema need to load up too
pending.push(defPromise) ;
}
// start by loading the test (it might be inline, but
// loadTest deals with that
pending.push(this.loadTest(params)
.then(function(test) {
// if the test is NOT an object, turn it into one
if (typeof test === 'string') {
test = JSON.parse(test) ;
}
this.Test = test;
// Test should have information that we can put in the template
if (test.description) {
this.DescriptionText = test.description;
}
return new Promise(function(resolve, reject) {
if (test.assertions &&
typeof test.assertions === "object") {
// we have at least one assertion
// get the inline contents and the references to external files
var assertFiles = this._assertionRefs(test.assertions);
var promisedAsserts = assertFiles.map(function(item) {
return this.loadAssertion(item);
}.bind(this));
// Once all the loadAssertion promises resolve...
Promise.all(promisedAsserts)
.then(function (assertContents) {
// assertContents has assertions in document order
var assertIdx = 0;
// populate the display of assertions that are being exercised
// returns the list of top level assertions to walk through
var buildList = function(assertions, level) {
if (level === undefined) {
level = 1;
}
// accumulate the assertions - but only when level is 0
var list = [] ;
if (assertions) {
if (typeof assertions === "object" && assertions.hasOwnProperty('assertions')) {
// this is a conditionObject
if (level === 0) {
list.push(assertContents[assertIdx]);
}
this.AssertionText += "<li>" + assertContents[assertIdx++].title;
this.AssertionText += "<ol>";
buildList(assertions.assertions, level+1) ;
this.AssertionText += "</ol></li>\n";
} else {
// it is NOT a conditionObject - must be an array
assertions.forEach( function(assert) {
if (typeof assert === "object" && Array.isArray(assert)) {
this.AssertionText += "<ol>";
// it is a nested list - recurse
buildList(assert, level+1) ;
this.AssertionText += "</ol>\n";
} else if (typeof assert === "object" && !Array.isArray(assert) && assert.hasOwnProperty('assertions')) {
if (level === 0) {
list.push(assertContents[assertIdx]);
}
// there is a condition object in the array
this.AssertionText += "<li>" + assertContents[assertIdx++].title;
this.AssertionText += "<ol>";
buildList(assert, level+1) ; // capture the children too
this.AssertionText += "</ol></li>\n";
} else {
if (level === 0) {
list.push(assertContents[assertIdx]);
}
this.AssertionText += "<li>" + assertContents[assertIdx++].title + "</li>\n";
}
}.bind(this));
}
}
return list;
}.bind(this);
// Assertions will ONLY contain the top level assertions
this.Assertions = buildList(test.assertions, 0);
resolve(true);
}.bind(this))
.catch(function(err) {
reject(err);
}.bind(this));
} else {
if (!test.assertions) {
reject("Test has no assertion property");
} else {
reject("Test assertion property is not an Array");
}
}
}.bind(this));
}.bind(this)));
// once the DOM and the test / assertions are loaded... set us up
Promise.all(pending)
.then(function() {
this.loading = false;
this.init();
}.bind(this))
.catch(function(err) {
// loading the components failed somehow - report the errors and mark the test failed
test( function() {
assert_true(false, "Loading of test components failed: " +JSON.stringify(err)) ;
}, "Loading test components");
done() ;
return ;
}.bind(this));
return this;
}
JSONtest.prototype = {
/**
* @listens click
*/
init: function() {
'use strict';
// set up a handler
var runButton = document.getElementById(this.Params.runTest) ;
var closeButton = document.getElementById(this.Params.closeWindow) ;
var testInput = document.getElementById(this.Params.testInput) ;
var assertion = document.getElementById("assertion") ;
var desc = document.getElementById("testDescription") ;
if (!this.loading) {
runButton.disabled = false;
runButton.value = "Check JSON";
if (desc) {
desc.innerHTML = this.DescriptionText;
}
if (assertion) {
assertion.innerHTML = "<ol>" + this.AssertionText + "</ol>\n";
}
} else {
window.alert("Loading did not finish before init handler was called!");
}
// @@@TODO@@@ implement the output showing handler
if (0 && this.Properties && this.Properties.output && closeButton) {
// set up a callback
add_completion_callback( function() {
var p = new Promise(function(resolve) {
closeButton.style.display = "inline";
closeButton.disabled = false;
on_event(closeButton, "click", function() {
resolve(true);
});
}.bind(this));
p.then();
}.bind(this));
}
on_event(runButton, "click", function() {
// user clicked
var content = testInput.value;
runButton.disabled = true;
// make sure content is an object
if (typeof content === "string") {
try {
content = JSON.parse(content) ;
} catch(err) {
// if the parsing failed, create a special test and mark it failed
test( function() {
assert_true(false, "Parse of JSON failed: " + err) ;
}, "Parsing submitted input");
// and just give up
done();
return ;
}
}
// iterate over all of the tests for this instance
this.runTests(this.Assertions, content);
// explicitly tell the test framework we are done
done();
}.bind(this));
},
// runTests - process tests
/**
* @param {object} assertions - List of assertions to process
* @param {string} content - JSON(-LD) to be evaluated
* @param {string} [testAction='continue'] - state of test processing (in parent when recursing)
* @param {integer} [level=0] - depth of recursion since assertion lists can nest
* @param {string} [compareWith='and'] - the way the results of the referenced assertions should be compared
* @returns {string} - the testAction resulting from evaluating all of the assertions
*/
runTests: function(assertions, content, testAction, level, compareWith) {
'use strict';
// level
if (level === undefined) {
level = 1;
}
// testAction
if (testAction === undefined) {
testAction = 'continue';
}
// compareWith
if (compareWith === undefined) {
compareWith = 'and';
}
// for each assertion (in order) load the external json schema if
// one is referenced, or use the inline schema if supplied
// validate content against the referenced schema
var theResults = [] ;
if (assertions) {
assertions.forEach( function(assert, num) {
var expected = assert.hasOwnProperty('expectedResult') ? assert.expectedResult : 'valid' ;
var message = assert.hasOwnProperty('message') ? assert.message : "Result was not " + expected;
// first - what is the type of the assert
if (typeof assert === "object" && !Array.isArray(assert)) {
if (assert.hasOwnProperty("compareWith") && assert.hasOwnProperty("assertions") && Array.isArray(assert.assertions) ) {
// this is a comparisonObject
var r = this.runTests(assert.assertions, content, testAction, level+1, assert.compareWith);
// r is an object that contains, among other things, an array of results from the child assertions
testAction = r.action;
// evaluate the results against the compareWith setting
var result = true;
var data = r.results ;
var i;
if (assert.compareWith === "or") {
result = false;
for(i = 0; i < data.length; i++) {
if (data[i]) {
result = true;
}
}
} else {
for(i = 0; i < data.length; i++) {
if (!data[i]) {
result = false;
}
}
}
// create a test and push the result
test(function() {
var newAction = this.determineAction(assert, result) ;
// next time around we will use this action
testAction = newAction;
var err = ";";
if (testAction === 'abort') {
err += "; Aborting execution of remaining assertions;";
} else if (testAction === 'skip') {
err += "; Skipping execution of remaining assertions at level " + level + ";";
}
if (result === false) {
// test result was unexpected; use message
assert_true(result, message + err);
} else {
assert_true(result, err) ;
}
}.bind(this), "" + level + ":" + (num+1) + " " + assert.title);
// we are going to return out of this
return;
}
} else if (typeof assert === "object" && Array.isArray(assert)) {
// it is a nested list - recurse
var o = this.runTests(assert, content, testAction, level+1);
if (o.result && o.result === 'abort') {
// we are bailing out
testAction = 'abort';
}
}
if (testAction === 'abort') {
return {action: 'abort' };
}
var schemaName = "inline " + level + ":" + (num+1);
if (typeof assert === "string") {
// the assertion passed in is a file name; find it in the cache
if (this._assertionCache[assert]) {
assert = this._assertionCache[assert];
} else {
test( function() {
assert_true(false, "Reference to assertion " + assert + " at level " + level + ":" + (num+1) + " unresolved") ;
}, "Processing " + assert);
return ;
}
}
if (assert.assertionFile) {
schemaName = "external file " + assert.assertionFile + " " + level + ":" + (num+1);
}
var validate = null;
try {
validate = this.ajv.compile(assert);
}
catch(err) {
test( function() {
assert_true(false, "Compilation of schema " + level + ":" + (num+1) + " failed: " + err) ;
}, "Compiling " + schemaName);
return ;
}
if (testAction !== 'continue') {
// a previous test told us to not run this test; skip it
test(function() { }, "SKIPPED: " + assert.title);
} else {
// start an actual sub-test
test(function() {
var valid = validate(content) ;
var result = this.determineResult(assert, valid) ;
// remember the result
theResults.push(result);
var newAction = this.determineAction(assert, result) ;
// next time around we will use this action
testAction = newAction;
var err = ";";
if (validate.errors !== null) {
err = "; Errors: " + this.ajv.errorsText(validate.errors) + ";" ;
}
if (testAction === 'abort') {
err += "; Aborting execution of remaining assertions;";
} else if (testAction === 'skip') {
err += "; Skipping execution of remaining assertions at level " + level + ";";
}
if (result === false) {
// test result was unexpected; use message
assert_true(result, message + err);
} else {
assert_true(result, err) ;
}
}.bind(this), "" + level + ":" + (num+1) + " " + assert.title);
}
}.bind(this));
}
return { action: testAction, results: theResults} ;
},
determineResult: function(schema, valid) {
'use strict';
var r = 'valid' ;
if (schema.hasOwnProperty('expectedResult')) {
r = schema.expectedResult;
}
if (r === 'valid' && valid || r === 'invalid' && !valid) {
return true;
} else {
return false;
}
},
determineAction: function(schema, result) {
'use strict';
// mapping from results to actions
var mapping = {
'failAndContinue' : 'continue',
'failAndSkip' : 'skip',
'failAndAbort' : 'abort',
'passAndContinue': 'continue',
'passAndSkip' : 'skip',
'passAndAbort' : 'abort'
};
// if the result was as expected, then just keep going
if (result) {
return 'continue';
}
var a = 'failAndContinue';
if (schema.hasOwnProperty('onUnexpectedResult')) {
a = schema.onUnexpectedResult;
}
if (mapping[a]) {
return mapping[a];
} else {
return 'continue';
}
},
// loadAssertion - load an Assertion from an external JSON file
//
// returns a promise that resolves with the contents of the assertion file
loadAssertion: function(afile) {
'use strict';
if (typeof(afile) === 'string') {
var theFile = this._parseURI(afile);
// it is a file reference - load it
return new Promise(function(resolve, reject) {
this._loadFile("GET", theFile, true)
.then(function(data) {
data.assertionFile = afile;
this._assertionCache[afile] = data;
resolve(data);
}.bind(this))
.catch(function(err) {
if (typeof err === "object") {
err.theFile = theFile;
}
reject(err);
});
}.bind(this));
}
else if (afile.hasOwnProperty("assertionFile")) {
// this object is referecing an external assertion
return new Promise(function(resolve, reject) {
var theFile = this._parseURI(afile.assertionFile);
this._loadFile("GET", theFile, true)
.then(function(external) {
// okay - we have an external object
Object.keys(afile).forEach(function(key) {
if (key !== 'assertionFile') {
external[key] = afile[key];
}
});
resolve(external);
}.bind(this))
.catch(function(err) {
if (typeof err === "object") {
err.theFile = theFile;
}
reject(err);
});
}.bind(this));
} else {
// it is already a loaded assertion - just use it
return new Promise(function(resolve) {
resolve(afile);
});
}
},
// loadDefinition - load a JSON Schema definition from an external JSON file
//
// returns a promise that resolves with the contents of the definition file
loadDefinition: function(dfile) {
'use strict';
return new Promise(function(resolve, reject) {
this._loadFile("GET", this._parseURI(dfile), true)
.then(function(data) {
resolve(data);
}.bind(this))
.catch(function(err) {
reject(err);
});
}.bind(this));
},
// loadTest - load a test from an external JSON file
//
// returns a promise that resolves with the contents of the
// test
loadTest: function(params) {
'use strict';
if (params.hasOwnProperty('testFile')) {
// the test is referred to by a file name
return this._loadFile("GET", params.testFile);
} // else
return new Promise(function(resolve, reject) {
if (params.hasOwnProperty('test')) {
resolve(params.test);
} else {
reject("Must supply a 'test' or 'testFile' parameter");
}
});
},
_parseURI: function(theURI) {
'use strict';
// determine what the top level URI should be
if (theURI.indexOf('/') === -1) {
// no slash - it's relative to where we are
// so just use it
return this.TestDir + theURI;
} else if (theURI.indexOf('/') === 0 || theURI.indexOf('http:') === 0 || theURI.indexOf('https:') === 0) {
// it is an absolute URI so just use it
return theURI;
} else {
// it is relative and contains a slash.
// make it relative to the current test root
return this.Base + theURI;
}
},
/**
* return a list of all inline assertions or references
*
* @param {array} assertions list of assertions to examine
*/
_assertionRefs: function(assertions) {
'use strict';
var ret = [] ;
// when the reference is to an object that has an array of assertions in it (a conditionObject)
// then remember that one and loop over its embedded assertions
if (typeof(assertions) === "object" && !Array.isArray(assertions) && assertions.hasOwnProperty('assertions')) {
ret.push(assertions) ;
assertions = assertions.assertions;
}
if (typeof(assertions) === "object" && Array.isArray(assertions)) {
assertions.forEach( function(assert) {
// first - what is the type of the assert
if (typeof assert === "object" && Array.isArray(assert)) {
// it is a nested list - recurse
this._assertionRefs(assert).forEach( function(item) {
ret.push(item);
}.bind(this));
} else if (typeof assert === "object") {
ret.push(assert) ;
if (assert.hasOwnProperty("assertions")) {
// there are embedded assertions; get those too
ret.concat(this._assertionRefs(assert.assertions));
}
} else {
// it is a file name
ret.push(assert) ;
}
}.bind(this));
}
return ret;
},
// _loadFile - return a promise loading a file
//
_loadFile: function(method, url, parse) {
'use strict';
if (parse === undefined) {
parse = true;
}
return new Promise(function (resolve, reject) {
if (document.location.search) {
var s = document.location.search;
s = s.replace(/^\?/, '');
if (url.indexOf('?') !== -1) {
url += "&" + s;
} else {
url += "?" + s;
}
}
var xhr = new XMLHttpRequest();
xhr.open(method, url);
xhr.onload = function () {
if (this.status >= 200 && this.status < 300) {
var d = xhr.response;
if (parse) {
try {
d = JSON.parse(d);
resolve(d);
}
catch(err) {
reject({ status: this.status,
statusText: "Parsing of " + url + " failed: " + err }
);
}
} else {
resolve(d);
}
} else {
reject({
status: this.status,
statusText: xhr.statusText
});
}
};
xhr.onerror = function () {
reject({
status: this.status,
statusText: xhr.statusText
});
};
xhr.send();
});
},
};

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -0,0 +1,87 @@
# Copyright (c) 2016 W3C
# Released under the W3C Test Suite License: see LICENSE.txt
# This tool creates .html test files for the WPT harness from corresponding .text
# files that it finds in the tree for this test collection.
import re
import time
import json
import fnmatch
import os
import shutil
import sys
import argparse
TESTTREE = '..'
DEFDIR = '../definitions'
TEMPLATE = 'template'
parser = argparse.ArgumentParser()
parser.add_argument('--examples', action="store_const", const=1)
args = parser.parse_args()
# pull in the template
template = open(TEMPLATE, "r").read()
defList = []
defnames = ""
# find all of the definitions
for curdir, subdirList, fileList in os.walk(DEFDIR, topdown=True):
for file in fnmatch.filter(fileList, "*.json"):
theFile = os.path.join(curdir, file)
try:
testJSON = json.load(open(theFile, "r"))
except ValueError as e:
print "parse of " + theFile + " failed: " + e[0]
else:
theFile = re.sub("\.\./", "", theFile)
defList.append(theFile)
if (len(defList)):
defNames = '"' + '",\n "'.join(defList) + '"'
# iterate over the folders looking for .test files
for curdir, subdirList, fileList in os.walk(TESTTREE, topdown=True):
# sjip the definitions directory
subdirList[:] = [d for d in subdirList if d != "definitions"]
# skip the examples directory
if args.examples != 1:
subdirList[:] = [d for d in subdirList if d != "examples"]
for file in fnmatch.filter(fileList, "*.test"):
# for each .test file, create a corresponding .html file using template
theFile = os.path.join(curdir, file)
try:
testJSON = json.load(open(theFile, "r"))
except ValueError as e:
print "parse of " + theFile + " failed: " + e[0]
else:
rfile = re.sub("\.\./", "", file)
# interesting pattern is {{TESTFILE}}
tcopy = re.sub("{{TESTFILE}}", rfile, template)
tcopy = re.sub("{{SCHEMADEFS}}", defNames, tcopy)
if testJSON['name']:
tcopy = re.sub("{{TESTTITLE}}", testJSON['name'], tcopy)
# target file is basename of theFile + '-manual.html'
target = re.sub("\.test","-manual.html", theFile)
try:
out = open(target, "w")
out.write(tcopy)
out.close()
except:
print("Failed to create "+target)
else:
print("Created " + target)

Просмотреть файл

@ -0,0 +1,42 @@
<!doctype html>
<html>
<head>
<title>{{TESTTITLE}}</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/annotation-model/scripts/ajv.min.js"></script>
<script src="/annotation-model/scripts/JSONtest.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theDefinitions=[
{{SCHEMADEFS}}
];
var theTestFile="{{TESTFILE}}";
var runningTest = new JSONtest( {
"testInput" : "annotation-input",
"runTest" : "annotation-run",
"closeWindow" : "annotation-close",
"schemaDefs" : theDefinitions,
"testFile" : theTestFile
} ) ;
</script>
</head>
<body>
<p>Fill the textarea below with JSON output from your annotation client
implementation that supports the following criteria:</p>
<div id="testDescription"></div>
<p>Specifically, the following assertions will be evaluated:</p>
<div id="assertion"></div>
<form name="annotation" id="annotation">
<textarea name="annotation-input" id="annotation-input" style="width: 90%; height: 10em" >
</textarea>
<p><input type="button" id="annotation-run" name="Loading..." value="Loading...">
<input style="display: none" type="button" id="annotation-close"
name="Close" value="Close"></p>
</form>
</body>
</html>

Просмотреть файл

@ -0,0 +1,10 @@
Tree to Test the Tests
======================
This folder is meant to contain a collection of .jsonld files that mirror the
structure of the top level folders and subfolders with .test files. A script
(@@@TODO@@@) will walk this tree, taking each folder and running it through the
corresponding .test file to ensure that the test is working as expected. An
argument to that script will report on any .jsonld files that do not have a
corresponding .test file, and vice versa.

Просмотреть файл

@ -56,7 +56,26 @@
}, `If constructor is ${t[0]}, should throw a TypeError`);
});
// 2. If name is not a valid custom element name,
// 2. If constructor is an interface object or named constructor whose corresponding
// interface either is HTMLElement or has HTMLElement in its set of inherited interfaces,
// throw a TypeError and abort these steps.
[
[ 'HTMLElement', HTMLElement ],
[ 'HTMLButtonElement', HTMLButtonElement ],
[ 'HTMLImageElement', HTMLImageElement ],
[ 'HTMLMediaElement', HTMLMediaElement ],
[ 'Image' , Image ],
[ 'Audio' , Audio ],
[ 'Option', Option ],
].forEach(t => {
test(() => {
assert_throws(expectTypeError, () => {
customElements.define(`test-define-constructor-${t[0]}`, t[1]);
});
}, `If constructor is ${t[0]}, should throw a TypeError`);
});
// 3. If name is not a valid custom element name,
// then throw a SyntaxError and abort these steps.
let validCustomElementNames = [
// [a-z] (PCENChar)* '-' (PCENChar)*
@ -110,7 +129,7 @@
}, `Element names: defining an element named ${name} should throw a SyntaxError`);
});
// 3. If this CustomElementsRegistry contains an entry with name name,
// 4. If this CustomElementsRegistry contains an entry with name name,
// then throw a NotSupportedError and abort these steps.
test(() => {
customElements.define('test-define-dup-name', class {});
@ -119,7 +138,7 @@
});
}, 'If the name is already defined, should throw a NotSupportedError');
// 4. If this CustomElementsRegistry contains an entry with constructor constructor,
// 6. If this CustomElementsRegistry contains an entry with constructor constructor,
// then throw a NotSupportedError and abort these steps.
test(() => {
class TestDupConstructor {};
@ -129,7 +148,7 @@
});
}, 'If the constructor is already defined, should throw a NotSupportedError');
// 7.1. If extends is a valid custom element name,
// 10.1. If extends is a valid custom element name,
// then throw a NotSupportedError.
validCustomElementNames.forEach(name => {
test(() => {
@ -139,7 +158,7 @@
}, `If extends is ${name}, should throw a NotSupportedError`);
});
// 7.2. If the element interface for extends and the HTML namespace is HTMLUnknownElement
// 10.2. If the element interface for extends and the HTML namespace is HTMLUnknownElement
// (e.g., if extends does not indicate an element definition in this specification),
// then throw a NotSupportedError.
[
@ -159,19 +178,7 @@
}, `If extends is ${name}, should throw a NotSupportedError`);
});
// 8. Let observedAttributesIterable be Get(constructor, "observedAttributes").
// Rethrow any exceptions.
test(() => {
class C {
static get observedAttributes() { throw_rethrown_error(); }
attributeChangedCallback() {}
}
assert_rethrown(() => {
customElements.define('test-define-observedattributes-rethrow', C);
});
}, 'If constructor.observedAttributes throws, should rethrow');
// 10. Let prototype be Get(constructor, "prototype"). Rethrow any exceptions.
// 13.1. Let prototype be Get(constructor, "prototype"). Rethrow any exceptions.
function assert_rethrown(func, description) {
assert_throws({ name: 'rethrown' }, func, description);
}
@ -190,7 +197,8 @@
customElements.define('test-define-constructor-prototype-rethrow', BadConstructor);
});
}, 'If constructor.prototype throws, should rethrow');
// 11. If Type(prototype) is not Object,
// 13.2. If Type(prototype) is not Object,
// then throw a TypeError exception.
test(() => {
const c = (function () { }).bind({}); // prototype is undefined.
@ -206,15 +214,21 @@
});
}, 'If Type(constructor.prototype) is string, should throw a TypeError');
// 12. Let connectedCallback be Get(prototype, "connectedCallback"). Rethrow any exceptions.
// 13. If connectedCallback is not undefined, and IsCallable(connectedCallback) is false,
// then throw a TypeError exception.
// 14. Let disconnectedCallback be Get(prototype, "disconnectedCallback"). Rethrow any exceptions.
// 15. If disconnectedCallback is not undefined, and IsCallable(disconnectedCallback) is false,
// then throw a TypeError exception.
// 16. Let attributeChangedCallback be Get(prototype, "attributeChangedCallback"). Rethrow any exceptions.
// 17. If attributeChangedCallback is not undefined, and IsCallable(attributeChangedCallback) is false,
// then throw a TypeError exception.
// 13.4. Let connectedCallbackValue be Get(prototype, "connectedCallback").
// Rethrow any exceptions.
// 13.5. If connectedCallbackValue is not undefined, then set connectedCallback
// to the result of converting connectedCallbackValue to the Web IDL Function callback type.
// Rethrow any exceptions.
// 13.6. Let disconnectedCallbackValue be Get(prototype, "disconnectedCallback").
// Rethrow any exceptions.
// 13.7. If disconnectedCallbackValue is not undefined, then set disconnectedCallback
// to the result of converting disconnectedCallbackValue to the Web IDL Function callback type.
// Rethrow any exceptions.
// 13.8. Let attributeChangedCallbackValue be Get(prototype, "attributeChangedCallback").
// Rethrow any exceptions.
// 13.9. If attributeChangedCallbackValue is not undefined, then set attributeChangedCallback
// to the result of converting attributeChangedCallbackValue to the Web IDL Function callback type.
// Rethrow any exceptions.
[
'connectedCallback',
'disconnectedCallback',

Просмотреть файл

@ -193,19 +193,40 @@ with extension `.worker.js` that imports `testharness.js`. The test can
then use all the usual APIs, and can be run from the path to the
JavaScript file with the `.js` removed.
For example, one could write a test for the `Blob` constructor by
creating a `FileAPI/Blob-constructor.worker.js` as follows:
For example, one could write a test for the `FileReaderSync` API by
creating a `FileAPI/FileReaderSync.worker.js` as follows:
importScripts("/resources/testharness.js");
test(function () {
var blob = new Blob(["Hello"]);
var fr = new FileReaderSync();
assert_equals(fr.readAsText(blob), "Hello");
}, "FileReaderSync#readAsText.");
done();
This test could then be run from `FileAPI/FileReaderSync.worker`.
### Multi-global tests
Tests for features that exist in multiple global scopes can be written in a way
that they are automatically run in a window scope as well as a dedicated worker
scope.
In this case, the test is a JavaScript file with extension `.any.js`.
The test can then use all the usual APIs, and can be run from the path to the
JavaScript file with the `.js` replaced by `.worker` or `.html`.
For example, one could write a test for the `Blob` constructor by
creating a `FileAPI/Blob-constructor.any.js` as follows:
test(function () {
var blob = new Blob();
assert_equals(blob.size, 0);
assert_equals(blob.type, "");
assert_false(blob.isClosed);
}, "The Blob constructor.");
done();
This test could then be run from `FileAPI/Blob-constructor.worker`.
This test could then be run from `FileAPI/Blob-constructor.any.worker` as well
as `FileAPI/Blob-constructor.any.html`.
### Tests Involving Multiple Origins

Просмотреть файл

@ -50,6 +50,10 @@ test(function() {
'The document must have a URL value equal to the URL of the active document.');
}, 'URL value');
test(function() {
assert_equals(doc.baseURI, document.URL);
}, 'baseURI value');
test(function() {
assert_equals(doc.location, null,
'The document must have a location value of null.');

Просмотреть файл

@ -9,6 +9,7 @@ function checkMetadata(doc, contentType) {
assert_true(doc instanceof Document, "Should be Document");
assert_equals(doc.URL, document.URL, "URL");
assert_equals(doc.documentURI, document.URL, "documentURI");
assert_equals(doc.baseURI, document.URL, "baseURI");
assert_equals(doc.characterSet, "UTF-8", "characterSet");
assert_equals(doc.charset, "UTF-8", "charset");
assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding");

Просмотреть файл

@ -0,0 +1,118 @@
// Encrypted Media Extensions WebIDL
//
// NOTE: Please update the link below to the specification version from
// which this IDL was extracted.
//
// https://www.w3.org/TR/2016/WD-encrypted-media-20160610/
//
partial interface Navigator {
Promise<MediaKeySystemAccess> requestMediaKeySystemAccess (DOMString keySystem, sequence<MediaKeySystemConfiguration> supportedConfigurations);
};
enum MediaKeysRequirement {
"required",
"optional",
"not-allowed"
};
dictionary MediaKeySystemConfiguration {
DOMString label = "";
sequence<DOMString> initDataTypes = [];
sequence<MediaKeySystemMediaCapability> audioCapabilities = [];
sequence<MediaKeySystemMediaCapability> videoCapabilities = [];
MediaKeysRequirement distinctiveIdentifier = "optional";
MediaKeysRequirement persistentState = "optional";
sequence<DOMString> sessionTypes;
};
dictionary MediaKeySystemMediaCapability {
DOMString contentType = "";
DOMString robustness = "";
};
interface MediaKeySystemAccess {
readonly attribute DOMString keySystem;
MediaKeySystemConfiguration getConfiguration ();
Promise<MediaKeys> createMediaKeys ();
};
enum MediaKeySessionType {
"temporary",
"persistent-usage-record",
"persistent-license"
};
interface MediaKeys {
MediaKeySession createSession (optional MediaKeySessionType sessionType = "temporary");
Promise<boolean> setServerCertificate (BufferSource serverCertificate);
};
interface MediaKeySession : EventTarget {
readonly attribute DOMString sessionId;
readonly attribute unrestricted double expiration;
readonly attribute Promise<void> closed;
readonly attribute MediaKeyStatusMap keyStatuses;
attribute EventHandler onkeystatuseschange;
attribute EventHandler onmessage;
Promise<void> generateRequest (DOMString initDataType, BufferSource initData);
Promise<boolean> load (DOMString sessionId);
Promise<void> update (BufferSource response);
Promise<void> close ();
Promise<void> remove ();
};
interface MediaKeyStatusMap {
iterable<BufferSource,MediaKeyStatus>;
readonly attribute unsigned long size;
boolean has (BufferSource keyId);
any get (BufferSource keyId);
};
enum MediaKeyStatus {
"usable",
"expired",
"released",
"output-restricted",
"output-downscaled",
"status-pending",
"internal-error"
};
enum MediaKeyMessageType {
"license-request",
"license-renewal",
"license-release",
"individualization-request"
};
[ Constructor (DOMString type, optional MediaKeyMessageEventInit eventInitDict)]
interface MediaKeyMessageEvent : Event {
readonly attribute MediaKeyMessageType messageType;
readonly attribute ArrayBuffer message;
};
dictionary MediaKeyMessageEventInit : EventInit {
MediaKeyMessageType messageType = "license-request";
ArrayBuffer message;
};
// partial interface HTMLMediaElement : EventTarget {
partial interface HTMLMediaElement {
readonly attribute MediaKeys? mediaKeys;
attribute EventHandler onencrypted;
attribute EventHandler onwaitingforkey;
Promise<void> setMediaKeys (MediaKeys? mediaKeys);
};
[ Constructor (DOMString type, optional MediaEncryptedEventInit eventInitDict)]
interface MediaEncryptedEvent : Event {
readonly attribute DOMString initDataType;
readonly attribute ArrayBuffer? initData;
};
dictionary MediaEncryptedEventInit : EventInit {
DOMString initDataType = "";
ArrayBuffer? initData = null;
};

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test asynchronous creation of MediaKeys and MediaKeySession while running garbage collection</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -18,11 +18,9 @@
var initDataType;
var initData;
var mediaKeySession;
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test asynchronous setServerCertificate while running garbage collection</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -15,7 +15,7 @@
promise_test(function(test)
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var cert = new Uint8Array(200);

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test support of different initDataTypes.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -17,8 +17,7 @@
if (!result)
return Promise.resolve('Not supported');
var options = [ { initDataTypes: [initDataType] } ];
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', options)
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfigurationForInitDataType(initDataType))
.then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Invalid Clear Key License.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -27,11 +27,9 @@
});
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var keySession = mediaKeys.createSession();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test Clear Key handling of non-ASCII responses for update().</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -16,6 +16,7 @@
async_test(function(test)
{
var initDataType;
var initData;
var mediaKeySession;
function processMessage(event)
@ -34,15 +35,14 @@
});
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();
waitForEventAndRunStep('message', mediaKeySession, processMessage, test);
return mediaKeySession.generateRequest(initDataType, getInitData(initDataType));
return mediaKeySession.generateRequest(initDataType, initData);
});
}, 'Clear Key update() with non-ASCII response.');
</script>

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Verify v2 events</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -45,11 +45,9 @@
test.done();
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(test.step_func(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test handling of invalid initData for generateRequest().</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -21,7 +21,7 @@
if (!result)
return Promise.resolve('Not supported');
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfigurationForInitDataType(initDataType)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Verify MediaKeySession.keyStatuses with multiple sessions</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -89,11 +89,9 @@
test.done();
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession1 = mediaKeys.createSession();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Verify MediaKeySession.keyStatuses with multiple updates</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -61,11 +61,9 @@
}
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Verify MediaKeySession.keyStatuses</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -15,6 +15,7 @@
var mediaKeySession;
var initDataType;
var initData;
var closed = false;
// Even though key ids are uint8, using printable values so that
// they can be verified easily.
@ -40,7 +41,7 @@
});
}
function processKeyStatusesChange(event)
function checkKeyStatusFor2Keys()
{
// Two keys added, so both should show up in |keyStatuses|.
assert_equals(mediaKeySession.keyStatuses.size, 2);
@ -48,8 +49,8 @@
// Check |keyStatuses| for 2 entries.
var result = [];
for (var entry of mediaKeySession.keyStatuses) {
result.push({ key: arrayBufferAsString(entry[0]), value: entry[1] });
for (let [keyId, status] of mediaKeySession.keyStatuses) {
result.push({ key: arrayBufferAsString(keyId), value: status });
}
assert_object_equals(result,
[{ key: key1String, value: 'usable'}, { key: key2String, value: 'usable'}],
@ -84,28 +85,74 @@
// forEach() should return both entries.
result = [];
mediaKeySession.keyStatuses.forEach(function(value, key, map) {
result.push({ key: arrayBufferAsString(key), value: value });
mediaKeySession.keyStatuses.forEach(function(status, keyId) {
result.push({ key: arrayBufferAsString(keyId), value: status });
});
assert_object_equals(result,
[{ key: key1String, value: 'usable'}, { key: key2String, value: 'usable'}],
'keyStatuses.forEach() fails');
// has() and get() should return the expected values.
assert_true(mediaKeySession.keyStatuses.has(key1));
assert_true(mediaKeySession.keyStatuses.has(key2));
assert_false(mediaKeySession.keyStatuses.has(stringToUint8Array('123456')));
assert_equals(mediaKeySession.keyStatuses.get(key1), 'usable');
assert_equals(mediaKeySession.keyStatuses.get(key2), 'usable');
assert_equals(mediaKeySession.keyStatuses.get(stringToUint8Array('123456')), undefined);
test.done();
// Try some invalid keyIds.
var invalid1 = key1.subarray(0, key1.length - 1);
assert_false(mediaKeySession.keyStatuses.has(invalid1));
assert_equals(mediaKeySession.keyStatuses.get(invalid1), undefined);
var invalid2 = key1.subarray(1);
assert_false(mediaKeySession.keyStatuses.has(invalid2));
assert_equals(mediaKeySession.keyStatuses.get(invalid2), undefined);
var invalid3 = new Uint8Array(key1);
invalid3[0] += 1;
assert_false(mediaKeySession.keyStatuses.has(invalid3));
assert_equals(mediaKeySession.keyStatuses.get(invalid3), undefined);
var invalid4 = new Uint8Array(key1);
invalid4[invalid4.length - 1] -= 1;
assert_false(mediaKeySession.keyStatuses.has(invalid4));
assert_equals(mediaKeySession.keyStatuses.get(invalid4), undefined);
var invalid5 = new Uint8Array(key1.length + 1);
invalid5.set(key1, 1); // First element will be 0.
assert_false(mediaKeySession.keyStatuses.has(invalid5));
assert_equals(mediaKeySession.keyStatuses.get(invalid5), undefined);
var invalid6 = new Uint8Array(key1.length + 1);
invalid6.set(key1, 0); // Last element will be 0.
assert_false(mediaKeySession.keyStatuses.has(invalid6));
assert_equals(mediaKeySession.keyStatuses.get(invalid6), undefined);
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
function processKeyStatusesChange(event)
{
if ( !closed )
{
// The first keystatuseschange (caused by update())
// should include both keys.
checkKeyStatusFor2Keys();
mediaKeySession.close().catch(function(error) {
forceTestFailureFromPromise(test, error);
});
closed = true;
}
else
{
// The second keystatuseschange (caused by close())
// should not have any keys.
assert_equals(mediaKeySession.keyStatuses.size, 0);
test.done();
}
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test MediaKeys lifetime when adding a session</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -32,12 +32,9 @@
}
// Create a MediaKeys object with a session.
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
assert_equals(access.keySystem, 'org.w3.clearkey');
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test MediaKeys lifetime</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -13,7 +13,7 @@
async_test(function(test)
{
// Create a MediaKeys object and free immediately.
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
// Do nothing with the created object
@ -31,7 +31,7 @@
async_test(function(test)
{
var mediaKeys;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test MediaKeySession lifetime without release()</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -32,12 +32,9 @@
return window.internals.activeDOMObjectCount(document) - startingActiveDOMObjectCount;
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
assert_equals(access.keySystem, 'org.w3.clearkey');
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test MediaKeySession lifetime after release() without references</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -31,11 +31,10 @@
var mediaKeys;
var mediaKeySession1;
var mediaKeySession2;
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>MediaKeySession lifetime after release()</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -31,11 +31,9 @@
}
// Create 2 sessions.
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test multiple MediaKeys lifetimes</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -25,9 +25,7 @@
// with the new MediaKeys object.
function createMediaKeys()
{
return getSupportedInitDataType().then(function(type) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
return mediaKeys;

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Reloading during encrypted media playback</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -14,6 +14,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var mediaKeySession = null;
var hasSessionUpdateSucceeded = false;
var encryptedEventCount = 0;
@ -81,12 +82,12 @@
location.reload();
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
waitForEventAndRunStep('playing', video, onPlaying, test);
video.src = '../content/test-encrypted.webm';
video.src = content;
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.play();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test MediaKeySession not callable immediately after CreateSession().</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -15,7 +15,7 @@
promise_test(function()
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();
@ -31,7 +31,7 @@
promise_test(function()
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();
@ -46,7 +46,7 @@
promise_test(function()
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
var mediaKeySession = mediaKeys.createSession();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>onencrypted</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo" controls></video>
@ -19,6 +19,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var onEncrypted = function(event)
{
@ -33,7 +34,7 @@
};
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
video.src = '../content/test-encrypted.webm';
video.src = content;
}, 'encrypted fired on encrypted media file.');
</script>
</body>

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Multiple playbacks alternating between encrypted and clear sources.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -18,6 +18,10 @@
var encryptedEventCount = 0;
var playbackCount = 0;
// Content to be played. These files must be the same format.
var encryptedContent = 'webm/test-encrypted.webm';
var unencryptedContent = 'webm/test.webm';
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
@ -93,18 +97,20 @@
}
function startPlayback() {
// Alternate between encrypted and unencrypted files.
if (playbackCount % 2) {
video.src = '../content/test-vp8-vorbis-webvtt.webm';
// Unencrypted files don't require MediaKeys.
video.src = unencryptedContent;
video.play();
return;
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(encryptedContent)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.src = '../content/test-encrypted.webm';
video.src = encryptedContent;
assert_false(video.mediaKeys === null, "video.mediaKeys is null.");
video.play();
}).catch(function(error) {

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Clear Key Playback with Multiple Sessions</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -14,6 +14,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted-different-av-keys.webm';
var audioMediaKeySession = null;
var videoMediaKeySession = null;
var audioInitDataType = null;
@ -121,12 +122,12 @@
test.done();
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
waitForEventAndRunStep('playing', video, onPlaying, test);
video.src = '../content/test-encrypted-different-av-keys.webm';
video.src = content;
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.play();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Clear Key Playback</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -14,6 +14,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var isUpdatePromiseResolved = false;
var encryptedEventCount = 0;
@ -72,14 +73,14 @@
test.done();
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
waitForEventAndRunStep('playing', video, onPlaying, test);
video.src = '../content/test-encrypted.webm';
video.src = content;
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.play();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Clear Key Playback</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -14,6 +14,7 @@
async_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var isUpdatePromiseResolved = false;
var encryptedEventCount = 0;
@ -72,7 +73,7 @@
test.done();
}
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
@ -81,7 +82,7 @@
return video.setMediaKeys(mediaKeys);
}).then(function(result) {
video.src = '../content/test-encrypted.webm';
video.src = content;
video.play();
}).catch(function(error) {
forceTestFailureFromPromise(test, error);

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Clear Key Play Two Videos At Same Time</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -18,19 +18,20 @@
var keyId = stringToUint8Array('0123456789012345');
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
var content = 'webm/test-encrypted.webm';
promise_test(function(test)
{
var promises = [
play_video_as_promise(document.getElementById('testVideo'), '../content/test-encrypted.webm'),
play_video_as_promise(document.getElementById('secondVideo'), '../content/test-encrypted.webm')
play_video_as_promise(document.getElementById('testVideo'), content),
play_video_as_promise(document.getElementById('secondVideo'), content)
];
return Promise.all(promises);
}, 'Play two videos at the same time.');
function play_video_as_promise(video, content)
{
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
return video.setMediaKeys(mediaKeys);

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test navigator.requestMediaKeySystemAccess()</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Reset src after setMediaKeys()</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -18,6 +18,10 @@
var video = document.getElementById('testVideo');
assert_not_equals(video, null);
// Content to be played. These files must be the same format.
var content = 'webm/test-encrypted.webm';
var alternateContent = 'webm/test-encrypted-different-av-keys.webm';
var onEncrypted = function(event)
{
++encryptedEventIndex;
@ -28,7 +32,7 @@
// for the video stream each time .src is set.
if (encryptedEventIndex == 2) {
// Finished first video; set src to a different video.
video.src = '../content/test-encrypted-different-av-keys.webm';
video.src = alternateContent;
} else if (encryptedEventIndex == 4) {
// Finished second video.
test.done();
@ -36,7 +40,7 @@
};
// Create a MediaKeys object and assign it to video.
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}])
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content))
.then(function(access) {
assert_equals(access.keySystem, 'org.w3.clearkey');
return access.createMediaKeys();
@ -50,7 +54,7 @@
// Set src to a video.
waitForEventAndRunStep('encrypted', video, onEncrypted, test);
video.src = '../content/test-encrypted.webm';
video.src = content;
}).catch(function(error) {
forceTestFailureFromPromise(test, error);
});

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test MediaKeySession closed event</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -15,11 +15,10 @@
var initDataType;
var initData;
var mediaKeySession;
getSupportedInitDataType().then(function(type) {
initDataType = type;
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() again after playback</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -17,7 +17,7 @@
var keyId = stringToUint8Array('0123456789012345');
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
var content = '../content/test-encrypted.webm';
var content = 'webm/test-encrypted.webm';
var duration = 0.2;
return createMediaKeys(keyId, rawKey).then(function(mediaKeys) {

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() again after resetting src</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -17,7 +17,7 @@
var keyId = stringToUint8Array('0123456789012345');
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
var content = '../content/test-encrypted.webm';
var content = 'webm/test-encrypted.webm';
var duration = 0.2;
return createMediaKeys(keyId, rawKey).then(function(mediaKeys) {

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Set MediaKeys multiple times in parallel</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video"></video>
@ -56,6 +56,7 @@
promise_test(function(test)
{
var video = document.getElementById('video');
var content = 'webm/test-encrypted.webm';
var access;
var mediaKeys1;
var mediaKeys2;
@ -65,10 +66,10 @@
// Start a video now so that it is waiting for MediaKeys
// in order to continue.
video.src = '../content/test-encrypted.webm';
video.src = content;
video.play();
return wait_for_encrypted_event(video).then(function() {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content));
}).then(function(result) {
access = result;
return access.createMediaKeys();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() multiple times with different MediaKeys.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video"></video>
@ -14,13 +14,14 @@
promise_test(function(test)
{
var video = document.getElementById('video');
var content = 'webm/test-encrypted.webm';
var keySystemAccess;
var mediaKeys1;
var mediaKeys2;
assert_equals(video.mediaKeys, null);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
keySystemAccess = access;
// Create a mediaKeys.
return keySystemAccess.createMediaKeys();
@ -49,7 +50,7 @@
}).then(function() {
assert_true(video.mediaKeys === mediaKeys1);
// Load the media element to create the WebMediaPlayer.
video.src = '../content/test-encrypted.webm';
video.src = content;
// Set mediaKeys2 on video (switching MediaKeys) not
// supported after WebMediaPlayer is created.
return video.setMediaKeys(mediaKeys2);

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() multiple times with the same MediaKeys.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video"></video>
@ -14,11 +14,12 @@
promise_test(function(test)
{
var video = document.getElementById('video');
var content = 'webm/test-encrypted.webm';
var mediaKeys;
assert_equals(video.mediaKeys, null);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;
@ -33,7 +34,7 @@
}).then(function() {
assert_true(video.mediaKeys === mediaKeys);
// Load the media element to create the WebMediaPlayer.
video.src = '../content/test-encrypted.webm';
video.src = content;
// Set mediaKeys again on video should still return a
// resolved promise.
return video.setMediaKeys(mediaKeys);

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys() on multiple video elements.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video1"></video>
@ -18,7 +18,7 @@
var video2 = document.getElementById('video2');
var mediaKeys;
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>setMediaKeys</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="video"></video>
@ -34,7 +34,7 @@
assert_equals(error.name, 'TypeError');
// Create a MediaKeys object and assign it to video.
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration());
}).then(function(access) {
assert_equals(access.keySystem, 'org.w3.clearkey');
return access.createMediaKeys();

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test EME syntax</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>

Просмотреть файл

@ -3,8 +3,8 @@
<html>
<head>
<title>Unique origin is unable to create MediaKeys</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -36,7 +36,13 @@
var script = 'data:text/html,' +
'<script>' +
' window.onmessage = function(e) {' +
' navigator.requestMediaKeySystemAccess(\'org.w3.clearkey\', [{}]).then(function(access) {' +
' navigator.requestMediaKeySystemAccess(\'org.w3.clearkey\', [{' +
' initDataTypes: [ \'keyids\' ],' +
' audioCapabilities: [' +
' { contentType: \'audio/mp4; codecs="mp4a.40.2"\' },' +
' { contentType: \'audio/webm; codecs="opus"\' }' +
' ]' +
' }]).then(function(access) {' +
' return access.createMediaKeys();' +
' }).then(function(mediaKeys) {' +
' window.parent.postMessage({result: \'allowed\'}, \'*\');' +
@ -47,7 +53,13 @@
'<\/script>';
// Verify that this page can create a MediaKeys first.
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{
initDataTypes: [ 'keyids' ],
audioCapabilities: [
{ contentType: 'audio/mp4; codecs="mp4a.40.2"' },
{ contentType: 'audio/webm; codecs="opus"' }
]
}]).then(function(access) {
return access.createMediaKeys();
}).then(function(mediaKeys) {
// Success, so now create the iframe and try there.

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Test handling of invalid responses for update().</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
@ -16,6 +16,7 @@
async_test(function(test)
{
var initDataType;
var initData;
var mediaKeySession;
function repeat(pattern, count) {
@ -54,15 +55,14 @@
});
}
getSupportedInitDataType().then(function(type) {
initDataType = type;
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}).then(function(access) {
navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) {
initDataType = access.getConfiguration().initDataTypes[0];
initData = getInitData(initDataType);
return access.createMediaKeys();
}).then(function(mediaKeys) {
mediaKeySession = mediaKeys.createSession();
waitForEventAndRunStep('message', mediaKeySession, processMessage, test);
return mediaKeySession.generateRequest(initDataType, getInitData(initDataType));
return mediaKeySession.generateRequest(initDataType, initData);
});
}, 'update() with response longer than 64Kb characters.');
</script>

Просмотреть файл

@ -19,23 +19,8 @@ function consoleWrite(text)
function isInitDataTypeSupported(initDataType)
{
return navigator.requestMediaKeySystemAccess(
"org.w3.clearkey", [{ initDataTypes : [initDataType] }])
.then(function() { return(true); }, function() { return(false); });
}
// Returns a promise that is fulfilled with an initDataType that is supported,
// rejected if none are supported.
function getSupportedInitDataType()
{
var configuration = [{ initDataTypes : [ 'webm', 'cenc', 'keyids' ] }];
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', configuration)
.then(function(access) {
var initDataTypes = access.getConfiguration().initDataTypes;
assert_greater_than(initDataTypes.length, 0);
return Promise.resolve(initDataTypes[0]);
}, function(error) {
return Promise.reject('No supported initDataType.');
});
"org.w3.clearkey", getSimpleConfigurationForInitDataType(initDataType))
.then(function() { return true; }, function() { return false; });
}
function getInitData(initDataType)
@ -73,6 +58,54 @@ function getInitData(initDataType)
throw 'initDataType ' + initDataType + ' not supported.';
}
// Returns an array of audioCapabilities that includes entries for a set of
// codecs that should cover all user agents.
function getPossibleAudioCapabilities()
{
return [
{ contentType: 'audio/mp4; codecs="mp4a.40.2"' },
{ contentType: 'audio/webm; codecs="opus"' },
];
}
// Returns a trivial MediaKeySystemConfiguration that should be accepted,
// possibly as a subset of the specified capabilities, by all user agents.
function getSimpleConfiguration()
{
return [ {
initDataTypes : [ 'webm', 'cenc', 'keyids' ],
audioCapabilities: getPossibleAudioCapabilities()
} ];
}
// Returns a MediaKeySystemConfiguration for |initDataType| that should be
// accepted, possibly as a subset of the specified capabilities, by all
// user agents.
function getSimpleConfigurationForInitDataType(initDataType)
{
return [ {
initDataTypes: [ initDataType ],
audioCapabilities: getPossibleAudioCapabilities()
} ];
}
// Returns a MediaKeySystemConfiguration for |mediaFile| that specifies
// both audio and video capabilities for the specified file..
function getConfigurationForFile(mediaFile)
{
if (mediaFile.toLowerCase().endsWith('webm')) {
return [ {
initDataTypes: [ 'webm' ],
audioCapabilities: [ { contentType: 'audio/webm; codecs="opus"' } ],
videoCapabilities: [ { contentType: 'video/webm; codecs="vp8"' } ]
} ];
}
// NOTE: Supporting other mediaFormats is not currently implemented as
// Chromium only tests with WebM files.
throw 'mediaFile ' + mediaFile + ' not supported.';
}
function waitForEventAndRunStep(eventName, element, func, stepTest)
{
var eventCallback = function(event) {
@ -130,23 +163,23 @@ function dumpKeyStatuses(keyStatuses)
{
consoleWrite("for (var entry of keyStatuses)");
for (var entry of keyStatuses) {
consoleWrite(arrayBufferAsString(entry[0]) + ", " + entry[1]);
consoleWrite(arrayBufferAsString(entry[0]) + ": " + entry[1]);
}
consoleWrite("for (var key of keyStatuses.keys())");
for (var key of keyStatuses.keys()) {
consoleWrite(arrayBufferAsString(key));
consoleWrite("for (var keyId of keyStatuses.keys())");
for (var keyId of keyStatuses.keys()) {
consoleWrite(arrayBufferAsString(keyId));
}
consoleWrite("for (var value of keyStatuses.values())");
for (var value of keyStatuses.values()) {
consoleWrite(value);
consoleWrite("for (var status of keyStatuses.values())");
for (var status of keyStatuses.values()) {
consoleWrite(status);
}
consoleWrite("for (var entry of keyStatuses.entries())");
for (var entry of keyStatuses.entries()) {
consoleWrite(arrayBufferAsString(entry[0]) + ", " + entry[1]);
consoleWrite(arrayBufferAsString(entry[0]) + ": " + entry[1]);
}
consoleWrite("keyStatuses.forEach()");
keyStatuses.forEach(function(value, key, map) {
consoleWrite(arrayBufferAsString(key) + ", " + value);
keyStatuses.forEach(function(status, keyId) {
consoleWrite(arrayBufferAsString(keyId) + ": " + status);
});
}
@ -270,7 +303,7 @@ function createMediaKeys(keyId, key)
var request = stringToUint8Array(createKeyIDs(keyId));
var jwkSet = stringToUint8Array(createJWKSet(createJWK(keyId, key)));
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfigurationForInitDataType('keyids')).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

Просмотреть файл

@ -4,8 +4,8 @@
<head>
<title>Waiting for a key.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<video id="testVideo"></video>
@ -21,6 +21,7 @@
promise_test(function(test)
{
var video = document.getElementById('testVideo');
var content = 'webm/test-encrypted.webm';
var initData;
var initDataType;
var mediaKeySession;
@ -44,14 +45,14 @@
var rawKey = new Uint8Array([0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c]);
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', getConfigurationForFile(content)).then(function(access) {
debugMessage = 'createMediaKeys()';
return access.createMediaKeys();
}).then(function(mediaKeys) {
debugMessage = 'setMediaKeys()';
return video.setMediaKeys(mediaKeys);
}).then(function() {
video.src = '../content/test-encrypted.webm';
video.src = content;
video.play();
debugMessage = 'wait_for_encrypted_event()';
return wait_for_encrypted_event(video);

Двоичные данные
testing/web-platform/tests/encrypted-media/Google/webm/test.webm Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with DRM, mp4</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<!--<script src=/encrypted-media/content/content-metadata.js></script>-->
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/check-initdata-type.js></script>
</head>
<body>
<div id='log'></div>
<script>
var config = { keysystem: 'org.w3.clearkey' }
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,42 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Events with Clear Key</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/events.js></script>
</head>
<body>
<div id='log'></div>
<script>
getSupportedContent( 'org.w3.clearkey' )
.then( function( contents )
{
runTest( { keysystem: 'org.w3.clearkey',
content: contents[ 0 ],
messagehandler: messagehandler.bind( contents[ 0 ] ),
} );
} );
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Test handling of invalid initData for generateRequest()</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/generate-request-disallowed-input.js></script>
</head>
<body>
<div id='log'></div>
<script>
var config = { keysystem: 'org.w3.clearkey'
};
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Verify MediaKeySession.keyStatuses with multiple sessions, Clear Key</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/keystatuses-multiple-sessions.js></script>
</head>
<body>
<div id='log'></div>
<script>
getSupportedContent( 'org.w3.clearkey' )
.then( function( contents ) {
// Select a content item with multiple keys
var contentitem = contents.filter( function( item ) { return item.keys.length > 1; } )[ 0 ];
var config = { keysystem: 'org.w3.clearkey',
content: contentitem,
messagehandler: messagehandler.bind( contentitem ),
initDataType: 'keyids',
initData: getMultikeyInitDatas(contentitem,'keyids'),
};
runTest(config);
} );
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, persistent-usage-record session with Clear Key, mp4, event sequence</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-usage-record-events.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, persistent-usage-record session with Clear Key, mp4, event sequence</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-persistent-usage-record.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, persistent-usage-record session with Clear Key, mp4, event sequence</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-retrieve-persistent-usage-record.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2,
windowscript: 'resources/retrieve-persistent-usage-record.html' };
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful playback, Temporary session with Clear Key, mp4, validating events</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-events.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4, multiple keys in sequence</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-multikey-multisession.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-multikey'],
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getMultikeyInitDatas(contentitem,'keyids'),
duration: 5,
testcase: 'sequential' };
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,53 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4, multiple keys for audio/video</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-multikey.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-av-multikey'],
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2,
testcase: 'audio/video' };
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-setMediaKeys-first.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,54 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4, two videos</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary-two-videos.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement1" width="200px"></video>
<video id="videoelement2" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
config = { video: [ document.getElementById( 'videoelement1' ),
document.getElementById( 'videoelement2' ) ],
keysystem: 'org.w3.clearkey',
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Successful Playback, Temporary session with Clear Key, mp4</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<script src=/encrypted-media/util/testmediasource.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<!-- Content metadata -->
<script src=/encrypted-media/content/content-metadata.js></script>
<!-- Message handler for Clear Key keysystem -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/playback-temporary.js></script>
</head>
<body>
<div id='log'></div>
<div id='video'>
<video id="videoelement" width="200px"></video>
</div>
<script>
var contentitem = content['mp4-basic'],
config = { video: document.getElementById('videoelement'),
keysystem: 'org.w3.clearkey',
messagehandler: messagehandler.bind( contentitem ),
audioPath: contentitem.audio.path,
videoPath: contentitem.video.path,
audioType: contentitem.audio.type,
videoType: contentitem.video.type,
initDataType: 'keyids',
initData: getInitData(contentitem,'keyids'),
duration: 2 };
runTest(config);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<meta name="timeout" content="long">
<title>Encrypted Media Extensions: Test MediaKeySession not callable immediately after CreateSession().</title>
<link rel="help" href="https://w3c.github.io/encrypted-media/">
<!-- Web Platform Test Harness scripts -->
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!-- Helper scripts for Encrypted Media Extensions tests -->
<script src=/encrypted-media/util/utils.js></script>
<script src=/encrypted-media/util/utf8.js></script>
<script src=/encrypted-media/util/fetch.js></script>
<!-- Message handler for Clear Key -->
<script src=/encrypted-media/util/clearkey-messagehandler.js></script>
<!-- The script for this specific test -->
<script src=/encrypted-media/scripts/not-callable-after-createsession.js></script>
</head>
<body>
<div id='log'></div>
<script>
var config = { keysystem: 'org.w3.clearkey'
};
runTest(config);
</script>
</body>
</html>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше