| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>MediaMetadata interface</title> | 2 <title>MediaMetadata interface</title> |
| 3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script> | 5 <script> |
| 6 console.warn("dummy log entry to avoid an empty -expected.txt in virtual/"); | |
| 7 | 6 |
| 8 test(function() { | 7 test(function() { |
| 9 var metadata = new MediaMetadata({}); | 8 var metadata = new MediaMetadata({}); |
| 10 assert_true(metadata != null); | 9 assert_not_equals(metadata, null); |
| 11 | 10 |
| 12 var exception = false; | 11 var exception = false; |
| 13 try { | 12 try { |
| 14 metadata = new MediaMetadata("foobar"); | 13 metadata = new MediaMetadata("foobar"); |
| 15 } catch (e) { | 14 } catch (e) { |
| 16 exception = true; | 15 exception = true; |
| 17 } | 16 } |
| 18 assert_true(exception); | 17 assert_true(exception); |
| 19 | 18 |
| 20 exception = false; | 19 exception = false; |
| 21 try { | 20 try { |
| 22 metadata = new MediaMetadata(42); | 21 metadata = new MediaMetadata(42); |
| 23 } catch (e) { | 22 } catch (e) { |
| 24 exception = true; | 23 exception = true; |
| 25 } | 24 } |
| 26 assert_true(exception); | 25 assert_true(exception); |
| 27 }, 'Test that MediaMetadata is constructed using a dictionary'); | 26 }, 'Test that MediaMetadata is constructed using a dictionary'); |
| 28 | 27 |
| 29 test(function() { | 28 test(function() { |
| 30 var metadata = new MediaMetadata({ | 29 var metadata = new MediaMetadata({ |
| 31 title: 'foo', album: 'bar', artist: 'plop', | 30 title: 'foo', album: 'bar', artist: 'plop', |
| 32 artwork: [ { src: 'src1', sizes: 'sizes1', type: 'type1'}, | 31 artwork: [ { src: 'src1', sizes: 'sizes1', type: 'type1'}, |
| 33 { src: 'src2', sizes: 'sizes2', type: 'type2'} ] }); | 32 { src: 'src2', sizes: 'sizes2', type: 'type2'} ] }); |
| 34 assert_equals(metadata.title, 'foo'); | 33 assert_equals(metadata.title, 'foo'); |
| 35 assert_equals(metadata.album, 'bar'); | 34 assert_equals(metadata.album, 'bar'); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 53 assert_equals(metadata.album, ''); | 52 assert_equals(metadata.album, ''); |
| 54 assert_equals(0, metadata.artwork.length); | 53 assert_equals(0, metadata.artwork.length); |
| 55 }, 'Test the default values for MediaMetadata'); | 54 }, 'Test the default values for MediaMetadata'); |
| 56 | 55 |
| 57 test(function() { | 56 test(function() { |
| 58 var metadata = new MediaMetadata({ randomValueThatWillNotBeAdded: '... hopef
ully ;)' }); | 57 var metadata = new MediaMetadata({ randomValueThatWillNotBeAdded: '... hopef
ully ;)' }); |
| 59 assert_equals(metadata.randomValueThatWillNotBeAdded, undefined); | 58 assert_equals(metadata.randomValueThatWillNotBeAdded, undefined); |
| 60 }, 'Test that passing unknown values to the dictionary is a no-op'); | 59 }, 'Test that passing unknown values to the dictionary is a no-op'); |
| 61 | 60 |
| 62 </script> | 61 </script> |
| OLD | NEW |