Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 var consoleDiv = null; | 1 var consoleDiv = null; |
| 2 | 2 |
| 3 function consoleWrite(text) | 3 function consoleWrite(text) |
| 4 { | 4 { |
| 5 if (!consoleDiv && document.body) { | 5 if (!consoleDiv && document.body) { |
| 6 consoleDiv = document.createElement('div'); | 6 consoleDiv = document.createElement('div'); |
| 7 document.body.appendChild(consoleDiv); | 7 document.body.appendChild(consoleDiv); |
| 8 } | 8 } |
| 9 var span = document.createElement('span'); | 9 var span = document.createElement('span'); |
| 10 span.appendChild(document.createTextNode(text)); | 10 span.appendChild(document.createTextNode(text)); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 // so convert it into a printable string. | 123 // so convert it into a printable string. |
| 124 return String.fromCharCode.apply(null, new Uint8Array(buffer)); | 124 return String.fromCharCode.apply(null, new Uint8Array(buffer)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 function dumpKeyStatuses(keyStatuses) | 127 function dumpKeyStatuses(keyStatuses) |
| 128 { | 128 { |
| 129 consoleWrite("for (var entry of keyStatuses)"); | 129 consoleWrite("for (var entry of keyStatuses)"); |
| 130 for (var entry of keyStatuses) { | 130 for (var entry of keyStatuses) { |
| 131 consoleWrite(arrayBufferAsString(entry[0]) + ", " + entry[1]); | 131 consoleWrite(arrayBufferAsString(entry[0]) + ", " + entry[1]); |
| 132 } | 132 } |
| 133 consoleWrite("for (var key of keyStatuses.keys())"); | 133 consoleWrite("for (var keyId of keyStatuses.keys())"); |
| 134 for (var key of keyStatuses.keys()) { | 134 for (var keyId of keyStatuses.keys()) { |
| 135 consoleWrite(arrayBufferAsString(key)); | 135 consoleWrite(arrayBufferAsString(keyId)); |
| 136 } | 136 } |
| 137 consoleWrite("for (var value of keyStatuses.values())"); | 137 consoleWrite("for (var status of keyStatuses.values())"); |
| 138 for (var value of keyStatuses.values()) { | 138 for (var status of keyStatuses.values()) { |
| 139 consoleWrite(value); | 139 consoleWrite(status); |
| 140 } | 140 } |
| 141 consoleWrite("for (var entry of keyStatuses.entries())"); | 141 consoleWrite("for (var entry of keyStatuses.entries())"); |
| 142 for (var entry of keyStatuses.entries()) { | 142 for (var entry of keyStatuses.entries()) { |
| 143 consoleWrite(arrayBufferAsString(entry[0]) + ", " + entry[1]); | 143 consoleWrite(arrayBufferAsString(entry[0]) + ", " + entry[1]); |
| 144 } | 144 } |
| 145 consoleWrite("keyStatuses.forEach()"); | 145 consoleWrite("keyStatuses.forEach()"); |
| 146 keyStatuses.forEach(function(value, key, map) { | 146 keyStatuses.forEach(function(status, keyId) { |
| 147 consoleWrite(arrayBufferAsString(key) + ", " + value); | 147 consoleWrite(arrayBufferAsString(keyId) + ", " + status); |
|
ddorwin
2016/06/14 20:56:05
nit: A ':' will probably make more sense to a read
jrummell
2016/06/14 22:24:21
Done.
| |
| 148 }); | 148 }); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Verify that |keyStatuses| contains just the keys in |keys.expected| | 151 // Verify that |keyStatuses| contains just the keys in |keys.expected| |
| 152 // and none of the keys in |keys.unexpected|. All keys should have status | 152 // and none of the keys in |keys.unexpected|. All keys should have status |
| 153 // 'usable'. Example call: verifyKeyStatuses(mediaKeySession.keyStatuses, | 153 // 'usable'. Example call: verifyKeyStatuses(mediaKeySession.keyStatuses, |
| 154 // { expected: [key1], unexpected: [key2] }); | 154 // { expected: [key1], unexpected: [key2] }); |
| 155 function verifyKeyStatuses(keyStatuses, keys) | 155 function verifyKeyStatuses(keyStatuses, keys) |
| 156 { | 156 { |
| 157 var expected = keys.expected || []; | 157 var expected = keys.expected || []; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 video.play(); | 289 video.play(); |
| 290 return new Promise(function(resolve) { | 290 return new Promise(function(resolve) { |
| 291 video.addEventListener('timeupdate', function listener(event) { | 291 video.addEventListener('timeupdate', function listener(event) { |
| 292 if (event.target.currentTime < duration) | 292 if (event.target.currentTime < duration) |
| 293 return; | 293 return; |
| 294 video.removeEventListener('timeupdate', listener); | 294 video.removeEventListener('timeupdate', listener); |
| 295 resolve('success'); | 295 resolve('success'); |
| 296 }); | 296 }); |
| 297 }); | 297 }); |
| 298 } | 298 } |
| OLD | NEW |