Commit c2b6bcf7 authored by Thomas Guilbert's avatar Thomas Guilbert Committed by Commit Bot

Revert "[Fuchsia] Add WebEngineIntegrationTests.PlayVideo test"

This reverts commit 92842b6a.

Reason for revert: This breaks fuchsia/engine/browser/media_browsertest.cc
https://ci.chromium.org/p/chromium/builders/ci/Fuchsia%20ARM64/103950

Original change's description:
> [Fuchsia] Add WebEngineIntegrationTests.PlayVideo test
> 
> Previously there were tests that play audio and tests that play video,
> but no tests were playing a file with both audio and video. Also video
> was not played to the end. Added PlayVideo test that plays
> bear-vp9-opus.webm to the end. Also updated SetBlockMediaLoading tests
> to share play_video.html and reduce amount of duplicated code.
> 
> Bug: b/153914562
> Change-Id: Iba492ec252f692f7aa3f93c319d858a91bb38278
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2219404
> Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
> Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
> Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#773338}

TBR=kmarshall@chromium.org,sergeyu@chromium.org

Change-Id: Ief517228f418509838bb07a1318b4e7a80b1aedd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/153914562
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2222697Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773373}
parent 366394ac
...@@ -16,10 +16,7 @@ ...@@ -16,10 +16,7 @@
bear.onpause = function () { isPlaying = false; } bear.onpause = function () { isPlaying = false; }
bear.onplay = function() { document.title = 'playing'; } bear.onplay = function() { document.title = 'playing'; }
bear.onstalled = function() { document.title = 'stalled'; } bear.onstalled = function() { document.title = 'stalled'; }
bear.onended = function() { document.title = 'ended'; } bear.src = 'bear-vp8a.webm';
bear.src = 'bear-vp9-opus.webm';
document.body.appendChild(bear);
</script> </script>
</body> </body>
</html> </html>
...@@ -121,31 +121,6 @@ class WebEngineIntegrationTest : public testing::Test { ...@@ -121,31 +121,6 @@ class WebEngineIntegrationTest : public testing::Test {
return create_params; return create_params;
} }
// Returns CreateContextParams that has AUDIO feature enabled with an injected
// FakeAudioConsumerService.
fuchsia::web::CreateContextParams ContextParamsWithAudio() {
// Use a FilteredServiceDirectory in order to inject a fake AudioConsumer
// service.
fuchsia::web::CreateContextParams create_params =
ContextParamsWithFilteredServiceDirectory();
fake_audio_consumer_service_ =
std::make_unique<media::FakeAudioConsumerService>(
filtered_service_directory_->outgoing_directory()
->GetOrCreateDirectory("svc"));
create_params.set_features(fuchsia::web::ContextFeatureFlags::AUDIO);
return create_params;
}
fuchsia::web::CreateContextParams ContextParamsWithAudioAndTestData() {
fuchsia::web::CreateContextParams create_params = ContextParamsWithAudio();
create_params.mutable_content_directories()->push_back(
CreateTestDataDirectoryProvider());
return create_params;
}
void CreateNavigationListener() { void CreateNavigationListener() {
// Attach a navigation listener, to monitor the state of the Frame. // Attach a navigation listener, to monitor the state of the Frame.
navigation_listener_ = navigation_listener_ =
...@@ -195,12 +170,6 @@ class WebEngineIntegrationTest : public testing::Test { ...@@ -195,12 +170,6 @@ class WebEngineIntegrationTest : public testing::Test {
navigation_listener_->RunUntilUrlEquals(url); navigation_listener_->RunUntilUrlEquals(url);
} }
void LoadUrlWithUserActivation(base::StringPiece url) {
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
navigation_controller_.get(),
cr_fuchsia::CreateLoadUrlParamsWithUserActivation(), url));
}
void GrantPermission(fuchsia::web::PermissionType type, void GrantPermission(fuchsia::web::PermissionType type,
const std::string& origin) { const std::string& origin) {
fuchsia::web::PermissionDescriptor permission; fuchsia::web::PermissionDescriptor permission;
...@@ -249,8 +218,6 @@ class WebEngineIntegrationTest : public testing::Test { ...@@ -249,8 +218,6 @@ class WebEngineIntegrationTest : public testing::Test {
std::unique_ptr<base::fuchsia::FilteredServiceDirectory> std::unique_ptr<base::fuchsia::FilteredServiceDirectory>
filtered_service_directory_; filtered_service_directory_;
std::unique_ptr<media::FakeAudioConsumerService> fake_audio_consumer_service_;
DISALLOW_COPY_AND_ASSIGN(WebEngineIntegrationTest); DISALLOW_COPY_AND_ASSIGN(WebEngineIntegrationTest);
}; };
...@@ -503,36 +470,41 @@ TEST_F(WebEngineIntegrationTest, ContentDirectoryProvider) { ...@@ -503,36 +470,41 @@ TEST_F(WebEngineIntegrationTest, ContentDirectoryProvider) {
TEST_F(WebEngineIntegrationTest, PlayAudio) { TEST_F(WebEngineIntegrationTest, PlayAudio) {
StartWebEngine(); StartWebEngine();
CreateContextAndFrame(ContextParamsWithAudioAndTestData());
// Use a FilteredServiceDirectory in order to inject a fake AudioConsumer
// service.
fuchsia::web::CreateContextParams create_params =
ContextParamsWithFilteredServiceDirectory();
media::FakeAudioConsumerService fake_audio_consumer_service(
filtered_service_directory_->outgoing_directory()->GetOrCreateDirectory(
"svc"));
create_params.mutable_content_directories()->push_back(
CreateTestDataDirectoryProvider());
create_params.set_features(fuchsia::web::ContextFeatureFlags::AUDIO);
CreateContextAndFrame(std::move(create_params));
static uint16_t kTestMediaSessionId = 43; static uint16_t kTestMediaSessionId = 43;
frame_->SetMediaSessionId(kTestMediaSessionId); frame_->SetMediaSessionId(kTestMediaSessionId);
LoadUrlWithUserActivation("fuchsia-dir://testdata/play_audio.html"); EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
navigation_controller_.get(),
cr_fuchsia::CreateLoadUrlParamsWithUserActivation(),
"fuchsia-dir://testdata/play_audio.html"));
navigation_listener_->RunUntilTitleEquals("ended"); navigation_listener_->RunUntilTitleEquals("ended");
ASSERT_EQ(fake_audio_consumer_service_->num_instances(), 1U); ASSERT_EQ(fake_audio_consumer_service.num_instances(), 1U);
auto pos = fake_audio_consumer_service_->instance(0)->GetMediaPosition(); auto pos = fake_audio_consumer_service.instance(0)->GetMediaPosition();
EXPECT_GT(pos, base::TimeDelta::FromSecondsD(2.0)); EXPECT_GT(pos, base::TimeDelta::FromSecondsD(2.0));
EXPECT_LT(pos, base::TimeDelta::FromSecondsD(2.5)); EXPECT_LT(pos, base::TimeDelta::FromSecondsD(2.5));
EXPECT_EQ(fake_audio_consumer_service_->instance(0)->session_id(), EXPECT_EQ(fake_audio_consumer_service.instance(0)->session_id(),
kTestMediaSessionId); kTestMediaSessionId);
EXPECT_EQ(fake_audio_consumer_service_->instance(0)->volume(), 1.0); EXPECT_EQ(fake_audio_consumer_service.instance(0)->volume(), 1.0);
EXPECT_FALSE(fake_audio_consumer_service_->instance(0)->is_muted()); EXPECT_FALSE(fake_audio_consumer_service.instance(0)->is_muted());
}
TEST_F(WebEngineIntegrationTest, PlayVideo) {
StartWebEngine();
CreateContextAndFrame(ContextParamsWithAudioAndTestData());
frame_->SetBlockMediaLoading(false);
LoadUrlWithUserActivation("fuchsia-dir://testdata/play_video.html?autoplay");
navigation_listener_->RunUntilTitleEquals("ended");
} }
void WebEngineIntegrationTest::RunPermissionTest(bool grant) { void WebEngineIntegrationTest::RunPermissionTest(bool grant) {
...@@ -564,7 +536,10 @@ TEST_F(WebEngineIntegrationTest, PermissionGranted) { ...@@ -564,7 +536,10 @@ TEST_F(WebEngineIntegrationTest, PermissionGranted) {
TEST_F(WebEngineIntegrationTest, MicrophoneAccess_WithPermission) { TEST_F(WebEngineIntegrationTest, MicrophoneAccess_WithPermission) {
StartWebEngine(); StartWebEngine();
CreateContextAndFrame(ContextParamsWithAudio());
fuchsia::web::CreateContextParams create_params = DefaultContextParams();
create_params.set_features(fuchsia::web::ContextFeatureFlags::AUDIO);
CreateContextAndFrame(std::move(create_params));
GrantPermission(fuchsia::web::PermissionType::MICROPHONE, GrantPermission(fuchsia::web::PermissionType::MICROPHONE,
embedded_test_server_.GetURL("/").GetOrigin().spec()); embedded_test_server_.GetURL("/").GetOrigin().spec());
...@@ -578,7 +553,10 @@ TEST_F(WebEngineIntegrationTest, MicrophoneAccess_WithPermission) { ...@@ -578,7 +553,10 @@ TEST_F(WebEngineIntegrationTest, MicrophoneAccess_WithPermission) {
TEST_F(WebEngineIntegrationTest, MicrophoneAccess_WithoutPermission) { TEST_F(WebEngineIntegrationTest, MicrophoneAccess_WithoutPermission) {
StartWebEngine(); StartWebEngine();
CreateContextAndFrame(ContextParamsWithAudio());
fuchsia::web::CreateContextParams create_params = DefaultContextParams();
create_params.set_features(fuchsia::web::ContextFeatureFlags::AUDIO);
CreateContextAndFrame(std::move(create_params));
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse( EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
navigation_controller_.get(), fuchsia::web::LoadUrlParams(), navigation_controller_.get(), fuchsia::web::LoadUrlParams(),
...@@ -589,11 +567,19 @@ TEST_F(WebEngineIntegrationTest, MicrophoneAccess_WithoutPermission) { ...@@ -589,11 +567,19 @@ TEST_F(WebEngineIntegrationTest, MicrophoneAccess_WithoutPermission) {
TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_Blocked) { TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_Blocked) {
StartWebEngine(); StartWebEngine();
CreateContextAndFrame(ContextParamsWithAudioAndTestData());
fuchsia::web::CreateContextParams create_params =
DefaultContextParamsWithTestData();
auto features = fuchsia::web::ContextFeatureFlags::AUDIO;
create_params.set_features(features);
CreateContextAndFrame(std::move(create_params));
frame_->SetBlockMediaLoading(true); frame_->SetBlockMediaLoading(true);
LoadUrlWithUserActivation("fuchsia-dir://testdata/play_video.html?autoplay"); EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
navigation_controller_.get(),
cr_fuchsia::CreateLoadUrlParamsWithUserActivation(),
"fuchsia-dir://testdata/play_vp8.html?autoplay"));
// Check different indicators that media has not loaded and is not playing. // Check different indicators that media has not loaded and is not playing.
navigation_listener_->RunUntilTitleEquals("stalled"); navigation_listener_->RunUntilTitleEquals("stalled");
...@@ -607,11 +593,19 @@ TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_Blocked) { ...@@ -607,11 +593,19 @@ TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_Blocked) {
// it begins playing, since autoplay=true. // it begins playing, since autoplay=true.
TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_AfterUnblock) { TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_AfterUnblock) {
StartWebEngine(); StartWebEngine();
CreateContextAndFrame(ContextParamsWithAudioAndTestData());
fuchsia::web::CreateContextParams create_params =
DefaultContextParamsWithTestData();
auto features = fuchsia::web::ContextFeatureFlags::AUDIO;
create_params.set_features(features);
CreateContextAndFrame(std::move(create_params));
frame_->SetBlockMediaLoading(true); frame_->SetBlockMediaLoading(true);
LoadUrlWithUserActivation("fuchsia-dir://testdata/play_video.html?autoplay"); EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
navigation_controller_.get(),
cr_fuchsia::CreateLoadUrlParamsWithUserActivation(),
"fuchsia-dir://testdata/play_vp8.html?autoplay"));
// Check that media loading has been blocked. // Check that media loading has been blocked.
navigation_listener_->RunUntilTitleEquals("stalled"); navigation_listener_->RunUntilTitleEquals("stalled");
...@@ -627,9 +621,17 @@ TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_AfterUnblock) { ...@@ -627,9 +621,17 @@ TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_AfterUnblock) {
// element has started loading that media will play when play() is called. // element has started loading that media will play when play() is called.
TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_SetBlockedAfterLoading) { TEST_F(WebEngineIntegrationTest, SetBlockMediaLoading_SetBlockedAfterLoading) {
StartWebEngine(); StartWebEngine();
CreateContextAndFrame(ContextParamsWithAudioAndTestData());
LoadUrlWithUserActivation("fuchsia-dir://testdata/play_video.html"); fuchsia::web::CreateContextParams create_params =
DefaultContextParamsWithTestData();
auto features = fuchsia::web::ContextFeatureFlags::AUDIO;
create_params.set_features(features);
CreateContextAndFrame(std::move(create_params));
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
navigation_controller_.get(),
cr_fuchsia::CreateLoadUrlParamsWithUserActivation(),
"fuchsia-dir://testdata/play_vp8.html"));
navigation_listener_->RunUntilTitleEquals("loaded"); navigation_listener_->RunUntilTitleEquals("loaded");
frame_->SetBlockMediaLoading(true); frame_->SetBlockMediaLoading(true);
......
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