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

Unified Diff: services/video_capture/video_capture_service_unittest.cc

Issue 2244773002: Video Capture Mojo (1.4c): Handle Subsequent Access (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FillServicePart2
Patch Set: rockot's comments Created 4 years, 3 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/video_capture_device_proxy_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/video_capture/video_capture_service_unittest.cc
diff --git a/services/video_capture/video_capture_service_unittest.cc b/services/video_capture/video_capture_service_unittest.cc
index cf9e8753b74eb430abd3dd06902ab964c40ca422..24d2d402c6c0a4900e17f01b42c6b99cd467dd84 100644
--- a/services/video_capture/video_capture_service_unittest.cc
+++ b/services/video_capture/video_capture_service_unittest.cc
@@ -14,6 +14,11 @@ using testing::InvokeWithoutArgs;
namespace video_capture {
+class MockCreateDeviceProxyCallback {
+ public:
+ MOCK_METHOD1(Run, void(mojom::DeviceAccessResultCode result_code));
+};
+
// Tests that an answer arrives from the service when calling
// EnumerateDeviceDescriptors().
TEST_F(VideoCaptureServiceTest, EnumerateDeviceDescriptorsCallbackArrives) {
@@ -55,18 +60,16 @@ TEST_F(VideoCaptureServiceTest, ErrorCodeOnCreateDeviceForInvalidDescriptor) {
invalid_descriptor->model_id = "invalid";
base::RunLoop wait_loop;
mojom::VideoCaptureDeviceProxyPtr fake_device_proxy;
- mojom::DeviceAccessResultCode result_code;
+ MockCreateDeviceProxyCallback create_device_proxy_callback;
+ EXPECT_CALL(create_device_proxy_callback,
+ Run(mojom::DeviceAccessResultCode::ERROR_DEVICE_NOT_FOUND))
+ .Times(1)
+ .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); }));
factory_->CreateDeviceProxy(
std::move(invalid_descriptor), mojo::GetProxy(&fake_device_proxy),
- base::Bind(
- [](base::RunLoop* wait_loop, mojom::DeviceAccessResultCode* target,
- mojom::DeviceAccessResultCode result_code) {
- *target = result_code;
- wait_loop->Quit();
- },
- &wait_loop, &result_code));
+ base::Bind(&MockCreateDeviceProxyCallback::Run,
+ base::Unretained(&create_device_proxy_callback)));
wait_loop.Run();
- ASSERT_EQ(mojom::DeviceAccessResultCode::ERROR_DEVICE_NOT_FOUND, result_code);
}
} // namespace video_capture
« no previous file with comments | « services/video_capture/video_capture_device_proxy_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698