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

Unified Diff: media/mojo/clients/mojo_renderer_unittest.cc

Issue 2539703002: media: Add |bad_message_cb_| to MojoRendererService (Closed)
Patch Set: add TODO and ref to bug Created 4 years, 1 month 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 | « no previous file | media/mojo/services/mojo_renderer_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/clients/mojo_renderer_unittest.cc
diff --git a/media/mojo/clients/mojo_renderer_unittest.cc b/media/mojo/clients/mojo_renderer_unittest.cc
index 296949b8ec2d89d95bad6806c4dce424ea773390..d2dadfd63c7860b8eef56a7d2c1a69ca6c72ac60 100644
--- a/media/mojo/clients/mojo_renderer_unittest.cc
+++ b/media/mojo/clients/mojo_renderer_unittest.cc
@@ -92,6 +92,7 @@ class MojoRendererTest : public ::testing::Test {
MOCK_METHOD1(OnInitialized, void(PipelineStatus));
MOCK_METHOD0(OnFlushed, void());
MOCK_METHOD1(OnCdmAttached, void(bool));
+ MOCK_METHOD1(OnSurfaceRequestToken, void(const base::UnguessableToken&));
std::unique_ptr<StrictMock<MockDemuxerStream>> CreateStream(
DemuxerStream::Type type) {
@@ -372,6 +373,22 @@ TEST_F(MojoRendererTest, GetMediaTime) {
Destroy();
}
+// When |initiate_surface_request_cb_| is not set, the client should not call
+// InitiateScopedSurfaceRequest(). Otherwise, it will cause the pipe to be
+// closed and MojoRendererService destroyed.
+TEST_F(MojoRendererTest, InitiateScopedSurfaceRequest) {
+ Initialize();
+ DCHECK(renderer_binding_);
+
+ EXPECT_CALL(renderer_client_, OnError(PIPELINE_ERROR_DECODE)).Times(1);
+
+ mojo_renderer_->InitiateScopedSurfaceRequest(base::Bind(
+ &MojoRendererTest::OnSurfaceRequestToken, base::Unretained(this)));
+ base::RunLoop().RunUntilIdle();
+
+ DCHECK(!renderer_binding_);
+}
+
TEST_F(MojoRendererTest, OnBufferingStateChange) {
Initialize();
Play();
« no previous file with comments | « no previous file | media/mojo/services/mojo_renderer_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698