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

Unified Diff: media/gpu/android_video_surface_chooser_impl_unittest.cc

Issue 2883913003: Add multiple destruction callbacks to AndroidOverlay. (Closed)
Patch Set: rebased.... though i got not conflicts? Created 3 years, 7 months 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 | « media/gpu/android_video_surface_chooser_impl.cc ('k') | media/gpu/content_video_view_overlay.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/android_video_surface_chooser_impl_unittest.cc
diff --git a/media/gpu/android_video_surface_chooser_impl_unittest.cc b/media/gpu/android_video_surface_chooser_impl_unittest.cc
index 58023076b24808a4727fd6434d30980e1713c89d..cfb9b8b63835978c689376eced266c85ad0b1ddf 100644
--- a/media/gpu/android_video_surface_chooser_impl_unittest.cc
+++ b/media/gpu/android_video_surface_chooser_impl_unittest.cc
@@ -39,7 +39,6 @@ class MockClient {
// Note that this won't clear |overlay_|, which is helpful.
MOCK_METHOD0(UseSurfaceTexture, void(void));
- MOCK_METHOD1(StopUsingOverlayImmediately, void(AndroidOverlay*));
private:
std::unique_ptr<AndroidOverlay> overlay_;
@@ -80,8 +79,6 @@ class AndroidVideoSurfaceChooserImplTest : public testing::Test {
chooser_->Initialize(
base::Bind(&MockClient::UseOverlayImpl, base::Unretained(&client_)),
base::Bind(&MockClient::UseSurfaceTexture, base::Unretained(&client_)),
- base::Bind(&MockClient::StopUsingOverlayImmediately,
- base::Unretained(&client_)),
std::move(factory));
}
@@ -200,63 +197,6 @@ TEST_F(AndroidVideoSurfaceChooserImplTest,
overlay_callbacks_.OverlayFailed.Run();
}
-TEST_F(AndroidVideoSurfaceChooserImplTest,
- OnSurfaceDestroyedSendsNotification) {
- // If |chooser_| is notified about OnSurfaceDestroyed, then |client_| should
- // also be notified.
-
- EXPECT_CALL(*this, MockOnOverlayCreated());
- StartChooser(FactoryFor(std::move(overlay_)));
- EXPECT_CALL(client_, UseOverlay(NotNull()));
- overlay_callbacks_.OverlayReady.Run();
-
- testing::Mock::VerifyAndClearExpectations(&client_);
- testing::Mock::VerifyAndClearExpectations(this);
-
- // Switch to a surface texture. OnSurfaceDestroyed should still be sent.
- EXPECT_CALL(client_, UseSurfaceTexture());
- chooser_->ReplaceOverlayFactory(AndroidOverlayFactoryCB());
- testing::Mock::VerifyAndClearExpectations(&client_);
-
- EXPECT_CALL(client_, StopUsingOverlayImmediately(NotNull()));
- overlay_callbacks_.SurfaceDestroyed.Run();
-}
-
-TEST_F(AndroidVideoSurfaceChooserImplTest,
- OnSurfaceDestroyedSendsNotificationAfterSwitch) {
- // This tests two things. First:
- // If |chooser_| is notified about OnSurfaceDestroyed, then |client_| should
- // also be notified even if |chooser_| has already told |client_| to
- // transition to SurfaceTexture. It has no idea if |client_| has actually
- // transitioned, so it has to notify it to stop immediately, in case it
- // hasn't. Second: |chooser_| should notify |client_| to switch to surface
- // texture if it provided an overlay, and the factory is changed. This
- // indicates that whoever provided the factory is revoking it, so we shouldn't
- // be using overlays from that factory anymore. We specifically test overlay
- // => no factory, since |chooser_| could elide multiple calls to switch to
- // surface texture.
- //
- // We test these together, since switching the factory is the only way we have
- // to make |chooser_| transition to SurfaceTexture without sending destroyed.
-
- EXPECT_CALL(*this, MockOnOverlayCreated());
- StartChooser(FactoryFor(std::move(overlay_)));
- EXPECT_CALL(client_, UseOverlay(NotNull()));
- overlay_callbacks_.OverlayReady.Run();
-
- testing::Mock::VerifyAndClearExpectations(&client_);
- testing::Mock::VerifyAndClearExpectations(this);
-
- // Switch factories, to notify the client back to switch to SurfaceTexture.
- EXPECT_CALL(client_, UseSurfaceTexture());
- chooser_->ReplaceOverlayFactory(AndroidOverlayFactoryCB());
- testing::Mock::VerifyAndClearExpectations(&client_);
-
- // Destroy the original surface.
- EXPECT_CALL(client_, StopUsingOverlayImmediately(NotNull()));
- overlay_callbacks_.SurfaceDestroyed.Run();
-}
-
TEST_F(AndroidVideoSurfaceChooserImplTest, NullLaterOverlayUsesSurfaceTexture) {
// If an overlay factory is provided after startup that returns a null overlay
// from CreateOverlay, |chooser_| should, at most, notify |client_| to use
« no previous file with comments | « media/gpu/android_video_surface_chooser_impl.cc ('k') | media/gpu/content_video_view_overlay.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698