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

Unified Diff: content/browser/media/session/media_session_impl_service_routing_unittest.cc

Issue 2585243002: [MediaSession] A fix for MediaSessionService routing (Closed)
Patch Set: fixed compile warning Created 4 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/browser/media/session/media_session_impl_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/session/media_session_impl_service_routing_unittest.cc
diff --git a/content/browser/media/session/media_session_impl_service_routing_unittest.cc b/content/browser/media/session/media_session_impl_service_routing_unittest.cc
index b1b8c64426907d934a6837557d41827b2947eda0..1f4867483ca24fde821124ae9b6947e235545f97 100644
--- a/content/browser/media/session/media_session_impl_service_routing_unittest.cc
+++ b/content/browser/media/session/media_session_impl_service_routing_unittest.cc
@@ -74,7 +74,10 @@ class MediaSessionImplServiceRoutingTest
protected:
void CreateServiceForFrame(TestRenderFrameHost* frame) {
services_[frame] = base::MakeUnique<MockMediaSessionServiceImpl>(frame);
- services_[frame]->SetMetadata(MediaMetadata());
+ }
+
+ void DestroyServiceForFrame(TestRenderFrameHost* frame) {
+ services_.erase(frame);
}
void StartPlayerForFrame(TestRenderFrameHost* frame) {
@@ -133,23 +136,37 @@ TEST_F(MediaSessionImplServiceRoutingTest,
}
TEST_F(MediaSessionImplServiceRoutingTest,
- OnlyMainFrameProducesAudioButHasInactiveService) {
- StartPlayerForFrame(main_frame_);
-
+ OnlyMainFrameProducesAudioButHasDestroyedService) {
CreateServiceForFrame(main_frame_);
- services_[main_frame_]->SetMetadata(base::nullopt);
+ StartPlayerForFrame(main_frame_);
+ DestroyServiceForFrame(main_frame_);
ASSERT_EQ(nullptr, ComputeServiceForRouting());
}
TEST_F(MediaSessionImplServiceRoutingTest,
- OnlySubFrameProducesAudioButHasInactiveService) {
+ OnlySubFrameProducesAudioButHasDestroyedService) {
+ CreateServiceForFrame(sub_frame_);
StartPlayerForFrame(sub_frame_);
+ DestroyServiceForFrame(sub_frame_);
+
+ ASSERT_EQ(nullptr, ComputeServiceForRouting());
+}
+
+TEST_F(MediaSessionImplServiceRoutingTest,
+ OnlyMainFrameProducesAudioAndServiceIsCreatedAfterwards) {
+ StartPlayerForFrame(main_frame_);
+ CreateServiceForFrame(main_frame_);
+
+ ASSERT_EQ(services_[main_frame_].get(), ComputeServiceForRouting());
+}
+TEST_F(MediaSessionImplServiceRoutingTest,
+ OnlySubFrameProducesAudioAndServiceIsCreatedAfterwards) {
+ StartPlayerForFrame(sub_frame_);
CreateServiceForFrame(sub_frame_);
- services_[sub_frame_]->SetMetadata(base::nullopt);
- ASSERT_EQ(nullptr, ComputeServiceForRouting());
+ ASSERT_EQ(services_[sub_frame_].get(), ComputeServiceForRouting());
}
TEST_F(MediaSessionImplServiceRoutingTest,
« no previous file with comments | « content/browser/media/session/media_session_impl_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698