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

Side by Side Diff: media/capture/video/video_capture_device_unittest.cc

Issue 2354783002: ImageCapture: Implement takePhoto() for Windows (Closed)
Patch Set: xianglu@ 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/capture/video/video_capture_device.h" 5 #include "media/capture/video/video_capture_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 #if defined(OS_MACOSX) 46 #if defined(OS_MACOSX)
47 // Mac will always give you the size you ask for and this case will fail. 47 // Mac will always give you the size you ask for and this case will fail.
48 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize 48 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize
49 // We will always get YUYV from the Mac AVFoundation implementations. 49 // We will always get YUYV from the Mac AVFoundation implementations.
50 #define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg 50 #define MAYBE_CaptureMjpeg DISABLED_CaptureMjpeg
51 #define MAYBE_TakePhoto TakePhoto 51 #define MAYBE_TakePhoto TakePhoto
52 #elif defined(OS_WIN) 52 #elif defined(OS_WIN)
53 #define MAYBE_AllocateBadSize AllocateBadSize 53 #define MAYBE_AllocateBadSize AllocateBadSize
54 #define MAYBE_CaptureMjpeg CaptureMjpeg 54 #define MAYBE_CaptureMjpeg CaptureMjpeg
55 #define MAYBE_TakePhoto DISABLED_TakePhoto 55 #define MAYBE_TakePhoto TakePhoto
56 #elif defined(OS_ANDROID) 56 #elif defined(OS_ANDROID)
57 #define MAYBE_AllocateBadSize AllocateBadSize 57 #define MAYBE_AllocateBadSize AllocateBadSize
58 #define MAYBE_CaptureMjpeg CaptureMjpeg 58 #define MAYBE_CaptureMjpeg CaptureMjpeg
59 #define MAYBE_TakePhoto TakePhoto 59 #define MAYBE_TakePhoto TakePhoto
60 #elif defined(OS_LINUX) 60 #elif defined(OS_LINUX)
61 // AllocateBadSize will hang when a real camera is attached and if more than one 61 // AllocateBadSize will hang when a real camera is attached and if more than one
62 // test is trying to use the camera (even across processes). Do NOT renable 62 // test is trying to use the camera (even across processes). Do NOT renable
63 // this test without fixing the many bugs associated with it: 63 // this test without fixing the many bugs associated with it:
64 // http://crbug.com/94134 http://crbug.com/137260 http://crbug.com/417824 64 // http://crbug.com/94134 http://crbug.com/137260 http://crbug.com/417824
65 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize 65 #define MAYBE_AllocateBadSize DISABLED_AllocateBadSize
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 #endif 528 #endif
529 529
530 std::unique_ptr<VideoCaptureDevice> device( 530 std::unique_ptr<VideoCaptureDevice> device(
531 video_capture_device_factory_->CreateDevice( 531 video_capture_device_factory_->CreateDevice(
532 device_descriptors_->front())); 532 device_descriptors_->front()));
533 ASSERT_TRUE(device); 533 ASSERT_TRUE(device);
534 534
535 EXPECT_CALL(*video_capture_client_, OnError(_, _)).Times(0); 535 EXPECT_CALL(*video_capture_client_, OnError(_, _)).Times(0);
536 536
537 VideoCaptureParams capture_params; 537 VideoCaptureParams capture_params;
538 capture_params.requested_format.frame_size.SetSize(640, 480); 538 capture_params.requested_format.frame_size.SetSize(320, 240);
539 capture_params.requested_format.frame_rate = 30; 539 capture_params.requested_format.frame_rate = 30;
540 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; 540 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420;
541 device->AllocateAndStart(capture_params, std::move(video_capture_client_)); 541 device->AllocateAndStart(capture_params, std::move(video_capture_client_));
542 WaitForCapturedFrame(); 542 WaitForCapturedFrame();
543 543
544 VideoCaptureDevice::TakePhotoCallback scoped_callback( 544 VideoCaptureDevice::TakePhotoCallback scoped_callback(
545 base::Bind(&MockImageCaptureClient::DoOnPhotoTaken, 545 base::Bind(&MockImageCaptureClient::DoOnPhotoTaken,
546 image_capture_client_), 546 image_capture_client_),
547 media::BindToCurrentLoop(base::Bind( 547 media::BindToCurrentLoop(base::Bind(
548 &MockImageCaptureClient::OnTakePhotoFailure, image_capture_client_))); 548 &MockImageCaptureClient::OnTakePhotoFailure, image_capture_client_)));
549 549
550 EXPECT_CALL(*image_capture_client_.get(), OnCorrectPhotoTaken()).Times(1); 550 EXPECT_CALL(*image_capture_client_.get(), OnCorrectPhotoTaken()).Times(1);
551 device->TakePhoto(std::move(scoped_callback)); 551 device->TakePhoto(std::move(scoped_callback));
552 WaitForCapturedFrame(); 552 WaitForCapturedFrame();
553 553
554 device->StopAndDeAllocate(); 554 device->StopAndDeAllocate();
555 } 555 }
556 556
557 }; // namespace media 557 }; // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/linux/v4l2_capture_delegate.cc ('k') | media/capture/video/win/video_capture_device_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698