| OLD | NEW |
| 1 /* | 1 /* |
| 2 * mediasessionservice-mock contains a mock implementation of MediaSessionServic
e. | 2 * mediasessionservice-mock contains a mock implementation of MediaSessionServic
e. |
| 3 */ | 3 */ |
| 4 | 4 |
| 5 "use strict"; | 5 "use strict"; |
| 6 | 6 |
| 7 var MediaSessionAction; |
| 8 |
| 7 function mojoString16ToJS(mojoString16) { | 9 function mojoString16ToJS(mojoString16) { |
| 8 return String.fromCharCode.apply(null, mojoString16.data); | 10 return String.fromCharCode.apply(null, mojoString16.data); |
| 9 } | 11 } |
| 10 | 12 |
| 11 function mojoImageToJS(mojoImage) { | 13 function mojoImageToJS(mojoImage) { |
| 12 var src = mojoImage.src.url; | 14 var src = mojoImage.src.url; |
| 13 var type = mojoString16ToJS(mojoImage.type); | 15 var type = mojoString16ToJS(mojoImage.type); |
| 14 var sizes = ""; | 16 var sizes = ""; |
| 15 for (var i = 0; i < mojoImage.sizes.length; i++) { | 17 for (var i = 0; i < mojoImage.sizes.length; i++) { |
| 16 if (i > 0) | 18 if (i > 0) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 return new MediaMetadata({title: title, artist: artist, album: album, artwork:
artwork}); | 38 return new MediaMetadata({title: title, artist: artist, album: album, artwork:
artwork}); |
| 37 } | 39 } |
| 38 | 40 |
| 39 let mediaSessionServiceMock = loadMojoModules( | 41 let mediaSessionServiceMock = loadMojoModules( |
| 40 'mediaSessionServiceMock', | 42 'mediaSessionServiceMock', |
| 41 ['third_party/WebKit/public/platform/modules/mediasession/media_session.mojo
m', | 43 ['third_party/WebKit/public/platform/modules/mediasession/media_session.mojo
m', |
| 42 'mojo/public/js/router', | 44 'mojo/public/js/router', |
| 43 ]).then(mojo => { | 45 ]).then(mojo => { |
| 44 let [mediaSessionService, router] = mojo.modules; | 46 let [mediaSessionService, router] = mojo.modules; |
| 45 | 47 |
| 48 MediaSessionAction = mediaSessionService.MediaSessionAction; |
| 49 |
| 46 class MediaSessionServiceMock { | 50 class MediaSessionServiceMock { |
| 47 constructor(interfaceProvider) { | 51 constructor(interfaceProvider) { |
| 48 interfaceProvider.addInterfaceOverrideForTesting( | 52 interfaceProvider.addInterfaceOverrideForTesting( |
| 49 mediaSessionService.MediaSessionService.name, | 53 mediaSessionService.MediaSessionService.name, |
| 50 handle => this.connectMediaSessionService_(handle)); | 54 handle => this.connectMediaSessionService_(handle)); |
| 51 this.interfaceProvider_ = interfaceProvider; | 55 this.interfaceProvider_ = interfaceProvider; |
| 52 this.pendingResponse_ = null; | 56 this.pendingResponse_ = null; |
| 53 } | 57 } |
| 54 | 58 |
| 55 connectMediaSessionService_(handle) { | 59 connectMediaSessionService_(handle) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 this.clientCallback_ = callback; | 95 this.clientCallback_ = callback; |
| 92 } | 96 } |
| 93 | 97 |
| 94 getClient() { | 98 getClient() { |
| 95 return this.client_; | 99 return this.client_; |
| 96 } | 100 } |
| 97 } | 101 } |
| 98 | 102 |
| 99 return new MediaSessionServiceMock(mojo.frameInterfaces); | 103 return new MediaSessionServiceMock(mojo.frameInterfaces); |
| 100 }); | 104 }); |
| OLD | NEW |