Commit 724a1a47 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Add camera test with MojoVideoCapture disabled.

On some devices MojoVideoCapture feature may need to be disabled in
order to save the memory required by the video_capture process. The new
test allows to verify that this configuration works as expected.

Bug: fuchsia:53041
Change-Id: Ie72bc03da4429fd070649b85d62e63493b470caf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363690
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarKevin Marshall <kmarshall@chromium.org>
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800215}
parent 44a0099e
......@@ -227,6 +227,8 @@ class WebEngineIntegrationTest : public testing::Test {
return value ? value->GetBool() : false;
}
void RunCameraTest(bool grant_permission);
protected:
void RunPermissionTest(bool grant);
......@@ -678,8 +680,7 @@ TEST_F(MAYBE_VulkanWebEngineIntegrationTest,
EXPECT_EQ(navigation_listener_->title(), "present");
}
TEST_F(WebEngineIntegrationTest, CameraAccess_WithPermission) {
StartWebEngine();
void WebEngineIntegrationTest::RunCameraTest(bool grant_permission) {
fuchsia::web::CreateContextParams create_params =
ContextParamsWithFilteredServiceDirectory();
......@@ -688,29 +689,33 @@ TEST_F(WebEngineIntegrationTest, CameraAccess_WithPermission) {
CreateContextAndFrame(std::move(create_params));
if (grant_permission) {
GrantPermission(fuchsia::web::PermissionType::CAMERA,
embedded_test_server_.GetURL("/").GetOrigin().spec());
}
const char* url =
grant_permission ? "/camera.html" : "/camera.html?NoPermission";
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
navigation_controller_.get(), fuchsia::web::LoadUrlParams(),
embedded_test_server_.GetURL("/camera.html").spec()));
embedded_test_server_.GetURL(url).spec()));
navigation_listener_->RunUntilTitleEquals("ended");
}
TEST_F(WebEngineIntegrationTest, CameraAccess_WithoutPermission) {
TEST_F(WebEngineIntegrationTest, CameraAccess_WithPermission) {
StartWebEngine();
fuchsia::web::CreateContextParams create_params =
ContextParamsWithFilteredServiceDirectory();
media::FakeCameraDeviceWatcher fake_camera_device_watcher(
filtered_service_directory_->outgoing_directory());
CreateContextAndFrame(std::move(create_params));
RunCameraTest(/*grant_permission=*/true);
}
EXPECT_TRUE(cr_fuchsia::LoadUrlAndExpectResponse(
navigation_controller_.get(), fuchsia::web::LoadUrlParams(),
embedded_test_server_.GetURL("/camera.html?NoPermission").spec()));
TEST_F(WebEngineIntegrationTest, CameraAccess_WithoutPermission) {
StartWebEngine();
RunCameraTest(/*grant_permission=*/false);
}
navigation_listener_->RunUntilTitleEquals("ended");
TEST_F(WebEngineIntegrationTest, CameraNoVideoCaptureProcess) {
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII("disable-features", "MojoVideoCapture");
StartWebEngine(std::move(command_line));
RunCameraTest(/*grant_permission=*/true);
}
\ No newline at end of file
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