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

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 android. 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 a27c96b3ac16ba636529829552bea3589e59eec2..e0f5599116cae9f44ad1dd8d0036e4b778d1ca2b 100644
--- a/content/test/web_contents_observer_sanity_checker.cc
+++ b/content/test/web_contents_observer_sanity_checker.cc
@@ -78,6 +78,9 @@ void WebContentsObserverSanityChecker::RenderFrameDeleted(
<< " for which RenderFrameCreated was never called";
#endif
}
+
+ // All players should have been paused by this point.
+ CHECK(active_media_players_.empty());
ncarter (slow) 2015/12/05 00:43:33 This CHECK needs to depend on |render_frame_host|,
DaleCurtis 2015/12/05 01:18:02 Whoops, yeah, done.
}
void WebContentsObserverSanityChecker::RenderFrameForInterstitialPageCreated(
@@ -252,6 +255,23 @@ 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::MediaPaused(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) {
@@ -270,6 +290,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