Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/clearkey-update-non-ascii-input.js

Issue 2546853003: Add W3C encrypted-media tests (Closed)
Patch Set: rebase now that content files landed Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/clearkey-update-non-ascii-input.js
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/clearkey-update-non-ascii-input.js b/third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/clearkey-update-non-ascii-input.js
new file mode 100644
index 0000000000000000000000000000000000000000..b34c493fd113a91780bf365800b71b98b6a3bfd6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/clearkey-update-non-ascii-input.js
@@ -0,0 +1,48 @@
+// This test is only applicable to clearkey
+function runTest(config, qualifier)
+{
+ var testname = testnamePrefix(qualifier, config.keysystem) + ' test handling of non-ASCII responses for update()';
+
+ var configuration = getSimpleConfigurationForContent(config.content);
+
+ if (config.initDataType) {
+ configuration.initDataTypes = [config.initDataType];
+ }
+
+ promise_test(function (test) {
+ var initDataType;
+ var initData;
+ var mediaKeySession;
+ var messageEventFired = false;
+
+ return navigator.requestMediaKeySystemAccess(config.keysystem, [configuration]).then(function (access) {
+ initDataType = access.getConfiguration().initDataTypes[0];
+ initData = getInitData(config.content, initDataType);
+ return access.createMediaKeys();
+ }).then(function (mediaKeys) {
+ mediaKeySession = mediaKeys.createSession();
+ var eventWatcher = new EventWatcher(test, mediaKeySession, ['message']);
+ var promise = eventWatcher.wait_for('message');
+ mediaKeySession.generateRequest(initDataType, initData);
+ return promise;
+ }).then(function (messageEvent) {
+ // |jwkSet| contains a non-ASCII character \uDC00.
+ var jwkSet = '{"keys":[{'
+ + '"kty":"oct",'
+ + '"k":"MDEyMzQ1Njc4OTAxMjM0NQ",'
+ + '"kid":"MDEyMzQ1Njc4O\uDC00TAxMjM0NQ"'
+ + '}]}';
+ messageEventFired = true;
+ return messageEvent.target.update(stringToUint8Array(jwkSet));
+ }).then(function () {
+ assert_unreached('Error: update() should fail because the processed message has non-ASCII character.');
+ }).catch(function (error) {
+ if(messageEventFired){
+ assert_equals(error.name, 'TypeError');
+ }
+ else {
+ assert_unreached('Error: ' + error.name);
+ }
+ });
+ }, testname);
+}

Powered by Google App Engine
This is Rietveld 408576698