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

Unified Diff: services/video_capture/test/fake_device_descriptor_unittest.cc

Issue 2843333006: Reland [Mojo Video Capture] Adapt video_capture service to refactored video capture stack (Closed)
Patch Set: Fix for flaky test Created 3 years, 8 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 | « services/video_capture/service_impl.cc ('k') | services/video_capture/test/fake_device_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/video_capture/test/fake_device_descriptor_unittest.cc
diff --git a/services/video_capture/test/fake_device_descriptor_unittest.cc b/services/video_capture/test/fake_device_descriptor_unittest.cc
index 4ef67ac1c1846aead4db796eef4acd0ed0148903..5565360b4bb33fb7d5d14b2657c325517b2c5c39 100644
--- a/services/video_capture/test/fake_device_descriptor_unittest.cc
+++ b/services/video_capture/test/fake_device_descriptor_unittest.cc
@@ -23,8 +23,8 @@ using FakeVideoCaptureDeviceDescriptorTest = FakeDeviceDescriptorTest;
// Tests that when requesting a second proxy for a device without closing the
// first one, the service revokes access to the first one by closing the
// connection.
-TEST_F(FakeVideoCaptureDeviceDescriptorTest,
- DISABLED_AccessIsRevokedOnSecondAccess) {
+TEST_F(FakeVideoCaptureDeviceDescriptorTest, AccessIsRevokedOnSecondAccess) {
+ base::RunLoop wait_loop_1;
mojom::DevicePtr device_proxy_1;
bool device_access_1_revoked = false;
MockCreateDeviceProxyCallback create_device_proxy_callback_1;
@@ -36,18 +36,21 @@ TEST_F(FakeVideoCaptureDeviceDescriptorTest,
mojo::MakeRequest(&device_proxy_1),
base::Bind(&MockCreateDeviceProxyCallback::Run,
base::Unretained(&create_device_proxy_callback_1)));
- device_proxy_1.set_connection_error_handler(
- base::Bind([](bool* access_revoked) { *access_revoked = true; },
- &device_access_1_revoked));
+ device_proxy_1.set_connection_error_handler(base::Bind(
+ [](bool* access_revoked, base::RunLoop* wait_loop_1) {
+ *access_revoked = true;
+ wait_loop_1->Quit();
+ },
+ &device_access_1_revoked, &wait_loop_1));
- base::RunLoop wait_loop;
+ base::RunLoop wait_loop_2;
mojom::DevicePtr device_proxy_2;
bool device_access_2_revoked = false;
MockCreateDeviceProxyCallback create_device_proxy_callback_2;
EXPECT_CALL(create_device_proxy_callback_2,
Run(mojom::DeviceAccessResultCode::SUCCESS))
.Times(1)
- .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); }));
+ .WillOnce(InvokeWithoutArgs([&wait_loop_2]() { wait_loop_2.Quit(); }));
factory_->CreateDevice(
fake_device_info_.descriptor.device_id,
mojo::MakeRequest(&device_proxy_2),
@@ -56,14 +59,14 @@ TEST_F(FakeVideoCaptureDeviceDescriptorTest,
device_proxy_2.set_connection_error_handler(
base::Bind([](bool* access_revoked) { *access_revoked = true; },
&device_access_2_revoked));
- wait_loop.Run();
+ wait_loop_1.Run();
+ wait_loop_2.Run();
ASSERT_TRUE(device_access_1_revoked);
ASSERT_FALSE(device_access_2_revoked);
}
// Tests that a second proxy requested for a device can be used successfully.
-TEST_F(FakeVideoCaptureDeviceDescriptorTest,
- DISABLED_CanUseSecondRequestedProxy) {
+TEST_F(FakeVideoCaptureDeviceDescriptorTest, CanUseSecondRequestedProxy) {
mojom::DevicePtr device_proxy_1;
factory_->CreateDevice(
fake_device_info_.descriptor.device_id,
@@ -92,7 +95,8 @@ TEST_F(FakeVideoCaptureDeviceDescriptorTest,
base::RunLoop wait_loop_2;
mojom::ReceiverPtr receiver_proxy;
MockReceiver receiver(mojo::MakeRequest(&receiver_proxy));
- EXPECT_CALL(receiver, OnIncomingCapturedVideoFramePtr(_))
+ EXPECT_CALL(receiver, DoOnNewBufferHandle(_, _));
+ EXPECT_CALL(receiver, DoOnFrameReadyInBuffer(_, _, _, _))
.WillRepeatedly(
InvokeWithoutArgs([&wait_loop_2]() { wait_loop_2.Quit(); }));
« no previous file with comments | « services/video_capture/service_impl.cc ('k') | services/video_capture/test/fake_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698