Commit bb003029 authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

media: Various fixes on MediaServiceTest

- Remove InitializeRenderer_InvalidConfig, which causes
  deserialization error and test timeout.
- Reenable tests now that http://crbug.com/594977 is fixed.
- Disable InitializeCdm* tests on Android. See Bug.

Bug: 829233
Test: Various test fixes.
Change-Id: Iaa4ac72a8e60a88559fa198e9f3c1da16aa0beb4
Reviewed-on: https://chromium-review.googlesource.com/996959
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548678}
parent 789f5a95
......@@ -32,18 +32,19 @@
#include "url/gurl.h"
#include "url/origin.h"
using testing::Exactly;
using testing::Invoke;
using testing::InvokeWithoutArgs;
using testing::NiceMock;
using testing::StrictMock;
namespace media {
namespace {
#if BUILDFLAG(ENABLE_MOJO_CDM)
#if BUILDFLAG(ENABLE_MOJO_CDM) && !defined(OS_ANDROID)
const char kClearKeyKeySystem[] = "org.w3.clearkey";
const char kInvalidKeySystem[] = "invalid.key.system";
#endif
const char kSecurityOrigin[] = "http://foo.com";
class MockRendererClient : public mojom::RendererClient {
......@@ -110,7 +111,6 @@ class MediaServiceTest : public service_manager::test::ServiceTest {
interface_factory_->CreateCdm(key_system, mojo::MakeRequest(&cdm_));
EXPECT_CALL(*this, OnCdmInitializedInternal(expected_result, cdm_id))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(run_loop_.get(), &base::RunLoop::Quit));
cdm_->Initialize(key_system, url::Origin::Create(GURL(kSecurityOrigin)),
CdmConfig(),
......@@ -136,7 +136,6 @@ class MediaServiceTest : public service_manager::test::ServiceTest {
renderer_client_binding_.Bind(mojo::MakeRequest(&client_ptr_info));
EXPECT_CALL(*this, OnRendererInitialized(expected_result))
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(run_loop_.get(), &base::RunLoop::Quit));
std::vector<mojom::DemuxerStreamPtrInfo> streams;
streams.push_back(std::move(video_stream_proxy_info));
......@@ -155,7 +154,7 @@ class MediaServiceTest : public service_manager::test::ServiceTest {
mojom::ContentDecryptionModulePtr cdm_;
mojom::RendererPtr renderer_;
StrictMock<MockRendererClient> renderer_client_;
NiceMock<MockRendererClient> renderer_client_;
mojo::AssociatedBinding<mojom::RendererClient> renderer_client_binding_;
StrictMock<MockDemuxerStream> video_stream_;
......@@ -170,7 +169,8 @@ class MediaServiceTest : public service_manager::test::ServiceTest {
// Note: base::RunLoop::RunUntilIdle() does not work well in these tests because
// even when the loop is idle, we may still have pending events in the pipe.
#if BUILDFLAG(ENABLE_MOJO_CDM)
// TODO(crbug.com/829233): Enable these tests on Android.
#if BUILDFLAG(ENABLE_MOJO_CDM) && !defined(OS_ANDROID)
TEST_F(MediaServiceTest, InitializeCdm_Success) {
InitializeCdm(kClearKeyKeySystem, true, 1);
run_loop_->Run();
......@@ -180,25 +180,13 @@ TEST_F(MediaServiceTest, InitializeCdm_InvalidKeySystem) {
InitializeCdm(kInvalidKeySystem, false, 0);
run_loop_->Run();
}
#endif // BUILDFLAG(ENABLE_MOJO_CDM)
#endif // BUILDFLAG(ENABLE_MOJO_CDM) && !defined(OS_ANDROID)
#if BUILDFLAG(ENABLE_MOJO_RENDERER)
// Sometimes fails on Linux. http://crbug.com/594977
#if defined(OS_LINUX)
#define MAYBE_InitializeRenderer_Success DISABLED_InitializeRenderer_Success
#else
#define MAYBE_InitializeRenderer_Success InitializeRenderer_Success
#endif
TEST_F(MediaServiceTest, MAYBE_InitializeRenderer_Success) {
TEST_F(MediaServiceTest, InitializeRenderer) {
InitializeRenderer(TestVideoConfig::Normal(), true);
run_loop_->Run();
}
TEST_F(MediaServiceTest, InitializeRenderer_InvalidConfig) {
InitializeRenderer(TestVideoConfig::Invalid(), false);
run_loop_->Run();
}
#endif // BUILDFLAG(ENABLE_MOJO_RENDERER)
TEST_F(MediaServiceTest, Lifetime) {
......@@ -217,7 +205,6 @@ TEST_F(MediaServiceTest, Lifetime) {
// Disconnecting InterfaceFactory service should terminate the app, which will
// close the connection.
EXPECT_CALL(*this, ConnectionClosed())
.Times(Exactly(1))
.WillOnce(Invoke(run_loop_.get(), &base::RunLoop::Quit));
interface_factory_.reset();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment