| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>MediaMetadata Mojo Test</title> | 2 <title>MediaMetadata Mojo Test</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 src="../../../resources/mojo-helpers.js"></script> | 5 <script src="../../../resources/mojo-helpers.js"></script> |
| 6 <script src="resources/mediasessionservice-mock.js"></script> | 6 <script src="resources/mediasessionservice-mock.js"></script> |
| 7 <script src="resources/utils.js"></script> | 7 <script src="resources/utils.js"></script> |
| 8 <script> | 8 <script> |
| 9 | 9 |
| 10 async_test(t => { | 10 async_test(t => { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 t.done(); | 47 t.done(); |
| 48 })); | 48 })); |
| 49 | 49 |
| 50 // Setting the metadata property will update the mojo service. | 50 // Setting the metadata property will update the mojo service. |
| 51 window.navigator.mediaSession.metadata = new MediaMetadata({}); | 51 window.navigator.mediaSession.metadata = new MediaMetadata({}); |
| 52 | 52 |
| 53 // All the next lines will produce only one call. | 53 // All the next lines will produce only one call. |
| 54 window.navigator.mediaSession.metadata.title = 'new title'; | 54 window.navigator.mediaSession.metadata.title = 'new title'; |
| 55 window.navigator.mediaSession.metadata.album = 'new album'; | 55 window.navigator.mediaSession.metadata.album = 'new album'; |
| 56 window.navigator.mediaSession.metadata.artist = 'new artist'; | 56 window.navigator.mediaSession.metadata.artist = 'new artist'; |
| 57 var image = new MediaImage( | 57 window.navigator.mediaSession.metadata.artwork = [ |
| 58 { src: 'http://example.com/', sizes: '40x40', type: 'image/png' }); | 58 { src: 'http://example.com/', sizes: '40x40', type: 'image/png' } |
| 59 window.navigator.mediaSession.metadata.artwork = [ image ]; | 59 ]; |
| 60 | 60 |
| 61 // This two last changes are made asynchronously and will go in different | 61 // This two last changes are made asynchronously and will go in different |
| 62 // mojo calls. | 62 // mojo calls. |
| 63 setTimeout(_ => { | 63 setTimeout(_ => { |
| 64 window.navigator.mediaSession.metadata.title = 'first timeout'; | 64 window.navigator.mediaSession.metadata.title = 'first timeout'; |
| 65 setTimeout(_ => { | 65 setTimeout(_ => { |
| 66 window.navigator.mediaSession.metadata.title = 'second timeout'; | 66 window.navigator.mediaSession.metadata.title = 'second timeout'; |
| 67 }); | 67 }); |
| 68 }); | 68 }); |
| 69 }); | 69 }); |
| 70 }, "test that MediaMetadata is correctly propagated twice"); | 70 }, "test that MediaMetadata is correctly propagated twice"); |
| 71 | 71 |
| 72 </script> | 72 </script> |
| OLD | NEW |