Bug 1632301 - part4 : rename 'ControlledMediaState' to 'MediaPlaybackState'. r=bryce
authoralwu <alwu@mozilla.com>
Tue, 28 Apr 2020 07:14:05 +0000
changeset 526400 55ac8f5b94725889afb734edbc27bc3d799277c7
parent 526399 ddf995c1bb1d16c79e4f48c4537e714f45fcceea
child 526401 9553e99137eadc9443532a044a430e82c9efd72f
push id114250
push useralwu@mozilla.com
push dateTue, 28 Apr 2020 07:14:58 +0000
treeherderautoland@55ac8f5b9472 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce
bugs1632301
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1632301 - part4 : rename 'ControlledMediaState' to 'MediaPlaybackState'. r=bryce This patch will do : - rename `ControlledMediaState` to `MediaPlaybackState` - rename the related functions The advantage of doing so : - more consistent with `MediaAudibleState` Differential Revision: https://phabricator.services.mozilla.com/D72060
dom/html/HTMLMediaElement.cpp
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
dom/media/mediacontrol/ContentMediaController.cpp
dom/media/mediacontrol/ContentMediaController.h
dom/media/mediacontrol/MediaControlIPC.h
dom/media/mediacontrol/MediaControlUtils.h
dom/media/mediacontrol/MediaController.cpp
dom/media/mediacontrol/MediaController.h
dom/media/mediacontrol/tests/gtest/TestMediaController.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -410,58 +410,58 @@ class HTMLMediaElement::MediaControlEven
 
     // Fail to init media agent, we are not able to notify the media controller
     // any update and also are not able to receive media control key events.
     if (!InitMediaAgent()) {
       MEDIACONTROL_LOG("Fail to init content media agent!");
       return false;
     }
 
-    NotifyMediaStateChanged(ControlledMediaState::eStarted);
+    NotifyPlaybackStateChanged(MediaPlaybackState::eStarted);
     return true;
   }
 
   void Stop() {
     MOZ_ASSERT(NS_IsMainThread());
     if (!IsStarted()) {
       // We have already been stopped, do not notify stop twice.
       return;
     }
-    NotifyMediaStateChanged(ControlledMediaState::eStopped);
+    NotifyPlaybackStateChanged(MediaPlaybackState::eStopped);
 
     // Remove ourselves from media agent, which would stop receiving event.
     mControlAgent->RemoveReceiver(this);
     mControlAgent = nullptr;
   }
 
-  bool IsStarted() const { return mState != ControlledMediaState::eStopped; }
+  bool IsStarted() const { return mState != MediaPlaybackState::eStopped; }
 
   /**
    * Following methods should only be used after starting listener.
    */
   void NotifyMediaStartedPlaying() {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(IsStarted());
-    if (mState == ControlledMediaState::eStarted ||
-        mState == ControlledMediaState::ePaused) {
-      NotifyMediaStateChanged(ControlledMediaState::ePlayed);
+    if (mState == MediaPlaybackState::eStarted ||
+        mState == MediaPlaybackState::ePaused) {
+      NotifyPlaybackStateChanged(MediaPlaybackState::ePlayed);
       // If media is `inaudible` in the beginning, then we don't need to notify
       // the state, because notifying `inaudible` should always come after
       // notifying `audible`.
       if (mIsOwnerAudible) {
         NotifyAudibleStateChanged(MediaAudibleState::eAudible);
       }
     }
   }
 
   void NotifyMediaStoppedPlaying() {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(IsStarted());
-    if (mState == ControlledMediaState::ePlayed) {
-      NotifyMediaStateChanged(ControlledMediaState::ePaused);
+    if (mState == MediaPlaybackState::ePlayed) {
+      NotifyPlaybackStateChanged(MediaPlaybackState::ePaused);
       // As media are going to be paused, so no sound is possible to be heard.
       if (mIsOwnerAudible) {
         NotifyAudibleStateChanged(MediaAudibleState::eInaudible);
       }
     }
   }
 
   void UpdateMediaAudibleState(bool aIsOwnerAudible) {
@@ -471,17 +471,17 @@ class HTMLMediaElement::MediaControlEven
       return;
     }
     mIsOwnerAudible = aIsOwnerAudible;
     MEDIACONTROL_LOG("Media becomes %s",
                      mIsOwnerAudible ? "audible" : "inaudible");
     // If media hasn't started playing, it doesn't make sense to update media
     // audible state. Therefore, in that case we would noitfy the audible state
     // when media starts playing.
-    if (mState == ControlledMediaState::ePlayed) {
+    if (mState == MediaPlaybackState::ePlayed) {
       NotifyAudibleStateChanged(mIsOwnerAudible
                                     ? MediaAudibleState::eAudible
                                     : MediaAudibleState::eInaudible);
     }
   }
 
   void SetPictureInPictureModeEnabled(bool aIsEnabled) {
     MOZ_ASSERT(NS_IsMainThread());
@@ -525,34 +525,34 @@ class HTMLMediaElement::MediaControlEven
     return true;
   }
 
   HTMLMediaElement* Owner() const {
     MOZ_ASSERT(mElement);
     return mElement.get();
   }
 
-  void NotifyMediaStateChanged(ControlledMediaState aState) {
+  void NotifyPlaybackStateChanged(MediaPlaybackState aState) {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(mControlAgent);
     MEDIACONTROL_LOG("NotifyMediaState from state='%s' to state='%s'",
-                     ToControlledMediaStateStr(mState),
-                     ToControlledMediaStateStr(aState));
+                     ToMediaPlaybackStateStr(mState),
+                     ToMediaPlaybackStateStr(aState));
     MOZ_ASSERT(mState != aState, "Should not notify same state again!");
     mState = aState;
-    mControlAgent->NotifyMediaStateChanged(this, mState);
+    mControlAgent->NotifyPlaybackStateChanged(this, mState);
   }
 
   void NotifyAudibleStateChanged(MediaAudibleState aState) {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(IsStarted());
     mControlAgent->NotifyAudibleStateChanged(this, aState);
   }
 
-  ControlledMediaState mState = ControlledMediaState::eStopped;
+  MediaPlaybackState mState = MediaPlaybackState::eStopped;
   WeakPtr<HTMLMediaElement> mElement;
   RefPtr<ContentMediaAgent> mControlAgent;
   bool mIsPictureInPictureEnabled = false;
   bool mIsOwnerAudible = false;
 };
 
 class HTMLMediaElement::MediaStreamTrackListener
     : public DOMMediaStream::TrackListener {
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -5783,25 +5783,25 @@ mozilla::ipc::IPCResult ContentParent::R
 }
 
 mozilla::ipc::IPCResult ContentParent::RecvStoreUserInteractionAsPermission(
     const Principal& aPrincipal) {
   ContentBlockingUserInteraction::Observe(aPrincipal);
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult ContentParent::RecvNotifyMediaStateChanged(
+mozilla::ipc::IPCResult ContentParent::RecvNotifyMediaPlaybackChanged(
     const MaybeDiscarded<BrowsingContext>& aContext,
-    ControlledMediaState aState) {
+    MediaPlaybackState aState) {
   if (aContext.IsNullOrDiscarded()) {
     return IPC_OK();
   }
   if (RefPtr<MediaController> controller =
           aContext.get_canonical()->GetMediaController()) {
-    controller->NotifyMediaStateChanged(aState);
+    controller->NotifyMediaPlaybackChanged(aState);
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult ContentParent::RecvNotifyMediaAudibleChanged(
     const MaybeDiscarded<BrowsingContext>& aContext, MediaAudibleState aState) {
   if (aContext.IsNullOrDiscarded()) {
     return IPC_OK();
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -1238,19 +1238,19 @@ class ContentParent final
       uint64_t aTopLevelWindowId, const Principal& aTrackingPrincipal,
       const nsCString& aTrackingOrigin, uint32_t aCookieBehavior,
       const ContentBlockingNotifier::StorageAccessGrantedReason& aReason,
       CompleteAllowAccessForResolver&& aResolver);
 
   mozilla::ipc::IPCResult RecvStoreUserInteractionAsPermission(
       const Principal& aPrincipal);
 
-  mozilla::ipc::IPCResult RecvNotifyMediaStateChanged(
+  mozilla::ipc::IPCResult RecvNotifyMediaPlaybackChanged(
       const MaybeDiscarded<BrowsingContext>& aContext,
-      ControlledMediaState aState);
+      MediaPlaybackState aState);
 
   mozilla::ipc::IPCResult RecvNotifyMediaAudibleChanged(
       const MaybeDiscarded<BrowsingContext>& aContext,
       MediaAudibleState aState);
 
   mozilla::ipc::IPCResult RecvNotifyPictureInPictureModeChanged(
       const MaybeDiscarded<BrowsingContext>& aContext, bool aEnabled);
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -112,17 +112,17 @@ using mozilla::dom::MaybeDiscardedWindow
 using mozilla::dom::WindowContextTransaction from "mozilla/dom/WindowContext.h";
 using mozilla::dom::WindowContextInitializer from "mozilla/dom/WindowContext.h";
 using base::SharedMemoryHandle from "base/shared_memory.h";
 using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h";
 using mozilla::fontlist::Pointer from "SharedFontList.h";
 using gfxSparseBitSet from "gfxFontUtils.h";
 using FontVisibility from "gfxFontEntry.h";
 using mozilla::dom::MediaControlKeysEvent from "ipc/MediaControlIPC.h";
-using mozilla::dom::ControlledMediaState from "ipc/MediaControlIPC.h";
+using mozilla::dom::MediaPlaybackState from "ipc/MediaControlIPC.h";
 using mozilla::dom::MediaAudibleState from "ipc/MediaControlIPC.h";
 using mozilla::dom::MaybeMediaMetadataBase from "mozilla/dom/MediaSessionIPCUtils.h";
 using mozilla::dom::MediaSessionPlaybackState from "mozilla/dom/MediaSessionBinding.h";
 using refcounted class nsDocShellLoadState from "nsDocShellLoadState.h";
 using mozilla::dom::ServiceWorkerShutdownState::Progress from "mozilla/dom/ServiceWorkerShutdownState.h";
 using refcounted class mozilla::dom::CrossProcessSHEntry from "mozilla/dom/MaybeNewPSHEntry.h";
 using mozilla::ContentBlockingNotifier::StorageAccessGrantedReason from "mozilla/ContentBlockingNotifier.h";
 using mozilla::ContentBlockingNotifier::BlockingDecision from "mozilla/ContentBlockingNotifier.h";
@@ -1503,18 +1503,18 @@ parent:
 
    /**
     * When media element's controlled state changed in the content process, we
     * have to notify the chrome process in order to update the status of the
     * corresponding media controller, which is used to control all media in the
     * certain tab. We would use the browsing context to find the corresponding
     * controller.
     */
-    async NotifyMediaStateChanged(MaybeDiscardedBrowsingContext aContext,
-                                  ControlledMediaState aState);
+    async NotifyMediaPlaybackChanged(MaybeDiscardedBrowsingContext aContext,
+                                     MediaPlaybackState aState);
 
    /**
     * When media became audible or inaudible in content process, we have to
     * notify chrome process in order to which tab is audible.
     */
     async NotifyMediaAudibleChanged(MaybeDiscardedBrowsingContext aContext,
                                     MediaAudibleState aState);
 
--- a/dom/media/mediacontrol/ContentMediaController.cpp
+++ b/dom/media/mediacontrol/ContentMediaController.cpp
@@ -87,39 +87,39 @@ void ContentMediaController::RemoveRecei
   // No more media needs to be controlled, so we can release this and recreate
   // it when someone needs it. We have to check `sControllers` because this can
   // be called via CC after we clear `sControllers`.
   if (mReceivers.IsEmpty() && sControllers) {
     sControllers->Remove(mTopLevelBrowsingContextId);
   }
 }
 
-void ContentMediaController::NotifyMediaStateChanged(
-    const ContentControlKeyEventReceiver* aMedia, ControlledMediaState aState) {
+void ContentMediaController::NotifyPlaybackStateChanged(
+    const ContentControlKeyEventReceiver* aMedia, MediaPlaybackState aState) {
   MOZ_ASSERT(NS_IsMainThread());
   if (!mReceivers.Contains(aMedia)) {
     return;
   }
 
   RefPtr<BrowsingContext> bc = aMedia->GetBrowsingContext();
   if (!bc || bc->IsDiscarded()) {
     return;
   }
 
-  LOG("Notify media %s in BC %" PRId64, ToControlledMediaStateStr(aState),
+  LOG("Notify media %s in BC %" PRId64, ToMediaPlaybackStateStr(aState),
       bc->Id());
   if (XRE_IsContentProcess()) {
     ContentChild* contentChild = ContentChild::GetSingleton();
-    Unused << contentChild->SendNotifyMediaStateChanged(bc, aState);
+    Unused << contentChild->SendNotifyMediaPlaybackChanged(bc, aState);
   } else {
     // Currently this only happen when we disable e10s, otherwise all controlled
     // media would be run in the content process.
     if (RefPtr<MediaController> controller =
             bc->Canonical()->GetMediaController()) {
-      controller->NotifyMediaStateChanged(aState);
+      controller->NotifyMediaPlaybackChanged(aState);
     }
   }
 }
 
 void ContentMediaController::NotifyAudibleStateChanged(
     const ContentControlKeyEventReceiver* aMedia, MediaAudibleState aState) {
   MOZ_ASSERT(NS_IsMainThread());
   if (!mReceivers.Contains(aMedia)) {
--- a/dom/media/mediacontrol/ContentMediaController.h
+++ b/dom/media/mediacontrol/ContentMediaController.h
@@ -21,17 +21,17 @@ class BrowsingContext;
  *             media controller
  * `eStopped`: media has unregistered from the content media controller, we can
  *             not control it anymore
  * When using these states to notify media controller, there are some rules we
  * MUST follow (1) `eStart` MUST be the first state and `eStop` MUST be the last
  * state (2) Do not notify same state again (3) `ePaused` can only be used after
  * notifying `ePlayed`.
  */
-enum class ControlledMediaState : uint32_t {
+enum class MediaPlaybackState : uint32_t {
   eStarted,
   ePlayed,
   ePaused,
   eStopped,
 };
 
 /**
  * This enum is used to update controlled media audible audible state to the
@@ -84,20 +84,20 @@ class ContentControlKeyEventReceiver {
 class ContentMediaAgent {
  public:
   NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
 
   // Return nullptr if the top level browsing context is no longer alive.
   static ContentMediaAgent* Get(BrowsingContext* aBC);
 
   // Use this method to update the media playback state of controlled media, and
-  // MUST follow the rule of ControlledMediaState.
-  virtual void NotifyMediaStateChanged(
+  // MUST follow the rule of MediaPlaybackState.
+  virtual void NotifyPlaybackStateChanged(
       const ContentControlKeyEventReceiver* aMedia,
-      ControlledMediaState aState) = 0;
+      MediaPlaybackState aState) = 0;
 
   // Use this method to update the audible state of controlled media, and MUST
   // follow the following rules in which `audible` and `inaudible` should be a
   // pair. `inaudible` should always be notified after `audible`. When audible
   // media paused, `inaudible` should be notified
   // Eg. (O) `audible` -> `inaudible` -> `audible` -> `inaudible`
   //     (X) `inaudible` -> `audible`    [notify `inaudible` before `audible`]
   //     (X) `audible` -> `audible`      [notify `audible` twice]
@@ -138,18 +138,18 @@ class ContentMediaController final : pub
                                      public ContentControlKeyEventReceiver {
  public:
   NS_INLINE_DECL_REFCOUNTING(ContentMediaController, override)
 
   explicit ContentMediaController(uint64_t aId);
   // ContentMediaAgent methods
   void AddReceiver(ContentControlKeyEventReceiver* aListener) override;
   void RemoveReceiver(ContentControlKeyEventReceiver* aListener) override;
-  void NotifyMediaStateChanged(const ContentControlKeyEventReceiver* aMedia,
-                               ControlledMediaState aState) override;
+  void NotifyPlaybackStateChanged(const ContentControlKeyEventReceiver* aMedia,
+                                  MediaPlaybackState aState) override;
   void NotifyAudibleStateChanged(const ContentControlKeyEventReceiver* aMedia,
                                  MediaAudibleState aState) override;
   void NotifyPictureInPictureModeChanged(
       const ContentControlKeyEventReceiver* aMedia, bool aEnabled) override;
 
   // ContentControlKeyEventReceiver method
   void HandleEvent(MediaControlKeysEvent aEvent) override;
 
--- a/dom/media/mediacontrol/MediaControlIPC.h
+++ b/dom/media/mediacontrol/MediaControlIPC.h
@@ -16,21 +16,21 @@ namespace IPC {
 template <>
 struct ParamTraits<mozilla::dom::MediaControlKeysEvent>
     : public ContiguousEnumSerializerInclusive<
           mozilla::dom::MediaControlKeysEvent,
           mozilla::dom::MediaControlKeysEvent::ePlay,
           mozilla::dom::MediaControlKeysEvent::eStop> {};
 
 template <>
-struct ParamTraits<mozilla::dom::ControlledMediaState>
+struct ParamTraits<mozilla::dom::MediaPlaybackState>
     : public ContiguousEnumSerializerInclusive<
-          mozilla::dom::ControlledMediaState,
-          mozilla::dom::ControlledMediaState::eStarted,
-          mozilla::dom::ControlledMediaState::eStopped> {};
+          mozilla::dom::MediaPlaybackState,
+          mozilla::dom::MediaPlaybackState::eStarted,
+          mozilla::dom::MediaPlaybackState::eStopped> {};
 
 template <>
 struct ParamTraits<mozilla::dom::MediaAudibleState>
     : public ContiguousEnumSerializerInclusive<
           mozilla::dom::MediaAudibleState,
           mozilla::dom::MediaAudibleState::eInaudible,
           mozilla::dom::MediaAudibleState::eAudible> {};
 
--- a/dom/media/mediacontrol/MediaControlUtils.h
+++ b/dom/media/mediacontrol/MediaControlUtils.h
@@ -73,25 +73,25 @@ inline MediaSessionPlaybackTestState Con
     case MediaSessionPlaybackState::Paused:
       return MediaSessionPlaybackTestState::Paused;
     default:
       MOZ_ASSERT(aState == MediaSessionPlaybackState::None);
       return MediaSessionPlaybackTestState::Stopped;
   }
 }
 
-inline const char* ToControlledMediaStateStr(ControlledMediaState aState) {
+inline const char* ToMediaPlaybackStateStr(MediaPlaybackState aState) {
   switch (aState) {
-    case ControlledMediaState::eStarted:
+    case MediaPlaybackState::eStarted:
       return "started";
-    case ControlledMediaState::ePlayed:
+    case MediaPlaybackState::ePlayed:
       return "played";
-    case ControlledMediaState::ePaused:
+    case MediaPlaybackState::ePaused:
       return "paused";
-    case ControlledMediaState::eStopped:
+    case MediaPlaybackState::eStopped:
       return "stopped";
     default:
       MOZ_ASSERT_UNREACHABLE("Invalid media state.");
       return "Unknown";
   }
 }
 
 BrowsingContext* GetAliveTopBrowsingContext(BrowsingContext* aBC);
--- a/dom/media/mediacontrol/MediaController.cpp
+++ b/dom/media/mediacontrol/MediaController.cpp
@@ -118,27 +118,27 @@ void MediaController::Shutdown() {
   // the corresponding controller. Therefore, we should manually remove the
   // controller from the service.
   Deactivate();
   mControlledMediaNum = 0;
   mPlayingControlledMediaNum = 0;
   mShutdown = true;
 }
 
-void MediaController::NotifyMediaStateChanged(ControlledMediaState aState) {
+void MediaController::NotifyMediaPlaybackChanged(MediaPlaybackState aState) {
   if (mShutdown) {
     return;
   }
-  if (aState == ControlledMediaState::eStarted) {
+  if (aState == MediaPlaybackState::eStarted) {
     IncreaseControlledMediaNum();
-  } else if (aState == ControlledMediaState::eStopped) {
+  } else if (aState == MediaPlaybackState::eStopped) {
     DecreaseControlledMediaNum();
-  } else if (aState == ControlledMediaState::ePlayed) {
+  } else if (aState == MediaPlaybackState::ePlayed) {
     IncreasePlayingControlledMediaNum();
-  } else if (aState == ControlledMediaState::ePaused) {
+  } else if (aState == MediaPlaybackState::ePaused) {
     DecreasePlayingControlledMediaNum();
   }
 }
 
 void MediaController::NotifyMediaAudibleChanged(MediaAudibleState aState) {
   if (mShutdown) {
     return;
   }
--- a/dom/media/mediacontrol/MediaController.h
+++ b/dom/media/mediacontrol/MediaController.h
@@ -78,17 +78,17 @@ class MediaController final
   uint64_t ControlledMediaNum() const;
   MediaSessionPlaybackState GetState() const;
 
   void SetDeclaredPlaybackState(uint64_t aSessionContextId,
                                 MediaSessionPlaybackState aState) override;
 
   // These methods are only being used to notify the state changes of controlled
   // media in ContentParent or MediaControlUtils.
-  void NotifyMediaStateChanged(ControlledMediaState aState);
+  void NotifyMediaPlaybackChanged(MediaPlaybackState aState);
   void NotifyMediaAudibleChanged(MediaAudibleState aState);
 
  private:
   ~MediaController();
 
   void UpdateMediaControlKeysEventToContentMediaIfNeeded(
       MediaControlKeysEvent aEvent);
   void IncreaseControlledMediaNum();
--- a/dom/media/mediacontrol/tests/gtest/TestMediaController.cpp
+++ b/dom/media/mediacontrol/tests/gtest/TestMediaController.cpp
@@ -15,46 +15,46 @@ TEST(MediaController, DefaultValueCheck)
 {
   RefPtr<MediaController> controller = new MediaController(CONTROLLER_ID);
   ASSERT_TRUE(controller->ControlledMediaNum() == 0);
   ASSERT_TRUE(controller->Id() == CONTROLLER_ID);
   ASSERT_TRUE(controller->GetState() == MediaSessionPlaybackState::None);
   ASSERT_TRUE(!controller->IsAudible());
 }
 
-TEST(MediaController, NotifyMediaStateChanged)
+TEST(MediaController, NotifyMediaPlaybackChanged)
 {
   RefPtr<MediaController> controller = new MediaController(CONTROLLER_ID);
   ASSERT_TRUE(controller->ControlledMediaNum() == 0);
 
-  controller->NotifyMediaStateChanged(ControlledMediaState::eStarted);
+  controller->NotifyMediaPlaybackChanged(MediaPlaybackState::eStarted);
   ASSERT_TRUE(controller->ControlledMediaNum() == 1);
 
-  controller->NotifyMediaStateChanged(ControlledMediaState::eStarted);
+  controller->NotifyMediaPlaybackChanged(MediaPlaybackState::eStarted);
   ASSERT_TRUE(controller->ControlledMediaNum() == 2);
 
-  controller->NotifyMediaStateChanged(ControlledMediaState::eStopped);
+  controller->NotifyMediaPlaybackChanged(MediaPlaybackState::eStopped);
   ASSERT_TRUE(controller->ControlledMediaNum() == 1);
 
-  controller->NotifyMediaStateChanged(ControlledMediaState::eStopped);
+  controller->NotifyMediaPlaybackChanged(MediaPlaybackState::eStopped);
   ASSERT_TRUE(controller->ControlledMediaNum() == 0);
 }
 
 TEST(MediaController, ActiveAndDeactiveController)
 {
   RefPtr<MediaControlService> service = MediaControlService::GetService();
   ASSERT_TRUE(service->GetActiveControllersNum() == 0);
 
   RefPtr<MediaController> controller1 =
       new MediaController(FIRST_CONTROLLER_ID);
 
-  controller1->NotifyMediaStateChanged(ControlledMediaState::eStarted);
+  controller1->NotifyMediaPlaybackChanged(MediaPlaybackState::eStarted);
   ASSERT_TRUE(service->GetActiveControllersNum() == 1);
 
-  controller1->NotifyMediaStateChanged(ControlledMediaState::eStopped);
+  controller1->NotifyMediaPlaybackChanged(MediaPlaybackState::eStopped);
   ASSERT_TRUE(service->GetActiveControllersNum() == 0);
 }
 
 TEST(MediaController, AudibleChanged)
 {
   RefPtr<MediaController> controller = new MediaController(CONTROLLER_ID);
   controller->Play();
   ASSERT_TRUE(!controller->IsAudible());
@@ -104,34 +104,33 @@ TEST(MediaController, ChangePlayingState
   controller->Stop();
   ASSERT_TRUE(controller->GetState() == MediaSessionPlaybackState::None);
 }
 
 class FakeControlledMedia final {
  public:
   explicit FakeControlledMedia(MediaController* aController)
       : mController(aController) {
-    mController->NotifyMediaStateChanged(ControlledMediaState::eStarted);
+    mController->NotifyMediaPlaybackChanged(MediaPlaybackState::eStarted);
   }
 
   void SetPlaying(bool aIsPlaying) {
     if (mIsPlaying == aIsPlaying) {
       return;
     }
-    mController->NotifyMediaStateChanged(aIsPlaying
-                                             ? ControlledMediaState::ePlayed
-                                             : ControlledMediaState::ePaused);
+    mController->NotifyMediaPlaybackChanged(
+        aIsPlaying ? MediaPlaybackState::ePlayed : MediaPlaybackState::ePaused);
     mIsPlaying = aIsPlaying;
   }
 
   ~FakeControlledMedia() {
     if (mIsPlaying) {
-      mController->NotifyMediaStateChanged(ControlledMediaState::ePaused);
+      mController->NotifyMediaPlaybackChanged(MediaPlaybackState::ePaused);
     }
-    mController->NotifyMediaStateChanged(ControlledMediaState::eStopped);
+    mController->NotifyMediaPlaybackChanged(MediaPlaybackState::eStopped);
   }
 
  private:
   bool mIsPlaying = false;
   RefPtr<MediaController> mController;
 };
 
 TEST(MediaController, PlayingStateChangeViaControlledMedia)