Commit 03b81ac9 authored by Jim Porter's avatar Jim Porter
Browse files

Merge pull request #13717 from jimporter/music-iac-restart

Bug 934011 - [music] Force closing the Music app breaks the controls; r=alive
parents e60d288b e0120f01
Loading
Loading
Loading
Loading
+20 −1
Changes for apps/system/test/marionette/media_playback_test.js: 20 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ marionette('media playback tests', function() {
        });
      });

      test('should play/pause from notification area', function() {
      test('should play/pause from now playing widget', function() {
        music.runInApp(function() {
          music.albumOneElement.click();
        });
@@ -139,6 +139,25 @@ marionette('media playback tests', function() {
        });
      });

      test('should play/pause from now playing widget after closing and ' +
           'reopening music app', function() {
        music.close();
        music.launchInBackground();

        music.runInApp(function() {
          music.albumOneElement.click();
        });

        playback[suiteInfo.opener](function(container) {
          container.waitForContainerShown(true);
          container.playPause();
          music.runInApp(function() {
            assert.equal(music.isPlaying, false);
          });
          assert.equal(container.isPlaying, false);
        });
      });

      test('should go to next/prev track from notification area', function() {
        music.runInApp(function() {
          music.albumOneElement.click();
+6 −4
Changes for shared/js/iac_handler.js: 6 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -2,7 +2,8 @@

var IACHandler = {
  _eventPrefix: 'iac-',
  _ports: [],
  _ports: {},

  init: function onInit() {
    var self = this;

@@ -11,10 +12,10 @@ var IACHandler = {
        var keyword = request.keyword;
        var port = request.port;

        // We will save each port by keyword
        if (!self._ports[keyword]) {
        // We will save each port by keyword; ports may get overwritten
        // sometimes, but that's ok because there should only be one *active*
        // port with a given keyword at any time.
        self._ports[keyword] = port;
        }

        port.onmessage = function onReceivedMessage(evt) {
          var message = evt.data;
@@ -40,6 +41,7 @@ var IACHandler = {
        };
    });
  },

  getPort: function(keyword) {
    return this._ports[keyword];
  }