Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2080)

Unified Diff: content/test/web_contents_observer_sanity_checker.cc

Issue 1478643002: Refactor media out of WebContentsImpl to MediaWebContentsObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix namespace for cast. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/web_contents_observer_sanity_checker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/web_contents_observer_sanity_checker.cc
diff --git a/content/test/web_contents_observer_sanity_checker.cc b/content/test/web_contents_observer_sanity_checker.cc
index ce22bedd7038e8cec3a2594d0d70cc6b0bcc48bd..187f51812e3346349241fc2fc61777697f446717 100644
--- a/content/test/web_contents_observer_sanity_checker.cc
+++ b/content/test/web_contents_observer_sanity_checker.cc
@@ -84,6 +84,10 @@ void WebContentsObserverSanityChecker::RenderFrameDeleted(
<< " for which RenderFrameCreated was never called";
#endif
}
+
+ // All players should have been paused by this point.
+ for (const auto& id : active_media_players_)
+ CHECK_NE(id.first, render_frame_host);
}
void WebContentsObserverSanityChecker::RenderFrameForInterstitialPageCreated(
@@ -258,6 +262,24 @@ void WebContentsObserverSanityChecker::DidOpenRequestedURL(
AssertRenderFrameExists(source_render_frame_host);
}
+void WebContentsObserverSanityChecker::MediaStartedPlaying(
+ const MediaPlayerId& id) {
+ CHECK(!web_contents_destroyed_);
+ CHECK(std::find(active_media_players_.begin(), active_media_players_.end(),
+ id) == active_media_players_.end());
+ active_media_players_.push_back(id);
+}
+
+void WebContentsObserverSanityChecker::MediaStoppedPlaying(
+ const MediaPlayerId& id) {
+ CHECK(!web_contents_destroyed_);
+ CHECK(std::find(active_media_players_.begin(), active_media_players_.end(),
+ id) != active_media_players_.end());
+ active_media_players_.erase(std::remove(active_media_players_.begin(),
+ active_media_players_.end(), id),
+ active_media_players_.end());
+}
+
bool WebContentsObserverSanityChecker::OnMessageReceived(
const IPC::Message& message,
RenderFrameHost* render_frame_host) {
@@ -276,6 +298,7 @@ void WebContentsObserverSanityChecker::WebContentsDestroyed() {
CHECK(!web_contents_destroyed_);
web_contents_destroyed_ = true;
CHECK(ongoing_navigations_.empty());
+ CHECK(active_media_players_.empty());
}
WebContentsObserverSanityChecker::WebContentsObserverSanityChecker(
« no previous file with comments | « content/test/web_contents_observer_sanity_checker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698