Commit fa523aaa authored by xhwang@chromium.org's avatar xhwang@chromium.org

Encrypted Media: Convert unprefixed syntax layout test to use testharness.js.

BUG=224791

Review URL: https://codereview.chromium.org/182453005

git-svn-id: svn://svn.chromium.org/blink/trunk@168884 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 139abbaf
This tests the basic API of MediaKeys and MediaKeySession.
Test MediaKeys.
EXPECTED (typeof window.MediaKeys == 'function') OK
TEST(new MediaKeys("")) THROWS(DOMException.INVALID_ACCESS_ERR: Failed to construct 'MediaKeys': The key system provided is invalid.) OK
TEST(new MediaKeys("unsupported")) THROWS(DOMException.NOT_SUPPORTED_ERR: Failed to construct 'MediaKeys': The 'unsupported' key system is not supported.) OK
RUN(mediaKeys = new MediaKeys("org.w3.clearkey"))
EXPECTED (typeof mediaKeys == 'object') OK
EXPECTED (mediaKeys.keySystem == 'org.w3.clearkey') OK
EXPECTED (typeof mediaKeys.createSession == 'function') OK
TEST(mediaKeys.createSession()) THROWS("TypeError: Failed to execute 'createSession' on 'MediaKeys': 2 arguments required, but only 0 present.") OK
TEST(mediaKeys.createSession("")) THROWS("TypeError: Failed to execute 'createSession' on 'MediaKeys': 2 arguments required, but only 1 present.") OK
TEST(mediaKeys.createSession("video/webm")) THROWS("TypeError: Failed to execute 'createSession' on 'MediaKeys': 2 arguments required, but only 1 present.") OK
TEST(mediaKeys.createSession("", new Uint8Array(1))) THROWS(DOMException.INVALID_ACCESS_ERR: Failed to execute 'createSession' on 'MediaKeys': The contentType provided ('') is empty.) OK
TEST(mediaKeys.createSession("video/webm", null)) THROWS(DOMException.INVALID_ACCESS_ERR: Failed to execute 'createSession' on 'MediaKeys': The initData provided is null or empty.) OK
TEST(mediaKeys.createSession("video/webm", new Uint8Array(0))) THROWS(DOMException.INVALID_ACCESS_ERR: Failed to execute 'createSession' on 'MediaKeys': The initData provided is null or empty.) OK
TEST(mediaKeys.createSession("unsupported/type", new Uint8Array(1))) THROWS(DOMException.NOT_SUPPORTED_ERR: Failed to execute 'createSession' on 'MediaKeys': The type provided ('unsupported/type') is unsupported.) OK
Test MediaKeySession.
RUN(mediaKeySession = mediaKeys.createSession("video/webm", initData))
EXPECTED (typeof mediaKeySession == 'object') OK
EXPECTED (typeof mediaKeySession.addEventListener == 'function') OK
EXPECTED (typeof mediaKeySession.update == 'function') OK
EXPECTED (mediaKeySession.error == 'null') OK
EXPECTED (mediaKeySession.keySystem == 'org.w3.clearkey') OK
EXPECTED (mediaKeySession.sessionId != 'null') OK
EXPECTED (mediaKeySession.onwebkitkeyadded == 'null') OK
EXPECTED (mediaKeySession.onwebkitkeyerror == 'null') OK
EXPECTED (mediaKeySession.onwebkitkeymessage == 'null') OK
TEST(mediaKeySession.update()) THROWS("TypeError: Failed to execute 'update' on 'MediaKeySession': 1 argument required, but only 0 present.") OK
TEST(mediaKeySession.update(null)) THROWS(DOMException.INVALID_ACCESS_ERR: Failed to execute 'update' on 'MediaKeySession': The response argument provided is invalid.) OK
RUN(mediaKeySession.update(new Uint8Array(1)))
RUN(mediaKeySession.release())
END OF TEST
This is a testharness.js-based test.
PASS Test MediaKeys constructor exceptions.
PASS Test MediaKeys constructor.
PASS Test MediaKeys createSession() exceptions.
PASS Test MediaKeys createSession().
PASS Test MediaKeySession update() exceptions.
PASS Test MediaKeySession update().
PASS Test MediaKeySession release().
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment