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

Side by Side Diff: content/renderer/media/video_capture_impl_unittest.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added DCHECK for valid sync token before IPC conversions Created 5 years, 1 month 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 "base/memory/shared_memory.h" 5 #include "base/memory/shared_memory.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "content/child/child_process.h" 7 #include "content/child/child_process.h"
8 #include "content/common/media/video_capture_messages.h" 8 #include "content/common/media/video_capture_messages.h"
9 #include "content/renderer/media/video_capture_impl.h" 9 #include "content/renderer/media/video_capture_impl.h"
10 #include "media/base/bind_to_current_loop.h" 10 #include "media/base/bind_to_current_loop.h"
(...skipping 30 matching lines...) Expand all
41 BufferReceivedTestArg(media::VideoPixelFormat pixel_format) 41 BufferReceivedTestArg(media::VideoPixelFormat pixel_format)
42 : pixel_format(pixel_format) {} 42 : pixel_format(pixel_format) {}
43 43
44 media::VideoPixelFormat pixel_format; 44 media::VideoPixelFormat pixel_format;
45 gpu::MailboxHolder mailbox_holder; 45 gpu::MailboxHolder mailbox_holder;
46 }; 46 };
47 47
48 static const BufferReceivedTestArg kBufferFormats[] = { 48 static const BufferReceivedTestArg kBufferFormats[] = {
49 BufferReceivedTestArg(media::PIXEL_FORMAT_I420), 49 BufferReceivedTestArg(media::PIXEL_FORMAT_I420),
50 BufferReceivedTestArg(media::PIXEL_FORMAT_ARGB, 50 BufferReceivedTestArg(media::PIXEL_FORMAT_ARGB,
51 gpu::MailboxHolder(gpu::Mailbox::Generate(), 0, 0))}; 51 gpu::MailboxHolder(gpu::Mailbox::Generate(),
52 gpu::SyncToken(),
53 0))};
52 54
53 class VideoCaptureImplTest 55 class VideoCaptureImplTest
54 : public ::testing::TestWithParam<BufferReceivedTestArg> { 56 : public ::testing::TestWithParam<BufferReceivedTestArg> {
55 public: 57 public:
56 class MockVideoCaptureImpl : public VideoCaptureImpl { 58 class MockVideoCaptureImpl : public VideoCaptureImpl {
57 public: 59 public:
58 MockVideoCaptureImpl(const media::VideoCaptureSessionId id, 60 MockVideoCaptureImpl(const media::VideoCaptureSessionId id,
59 VideoCaptureMessageFilter* filter) 61 VideoCaptureMessageFilter* filter)
60 : VideoCaptureImpl(id, filter), received_buffer_count_(0) {} 62 : VideoCaptureImpl(id, filter), received_buffer_count_(0) {}
61 ~MockVideoCaptureImpl() override {} 63 ~MockVideoCaptureImpl() override {}
(...skipping 29 matching lines...) Expand all
91 } 93 }
92 94
93 void DevicePauseCapture(int device_id) {} 95 void DevicePauseCapture(int device_id) {}
94 96
95 void DeviceStopCapture(int device_id) { 97 void DeviceStopCapture(int device_id) {
96 OnStateChanged(VIDEO_CAPTURE_STATE_STOPPED); 98 OnStateChanged(VIDEO_CAPTURE_STATE_STOPPED);
97 } 99 }
98 100
99 void DeviceReceiveEmptyBuffer(int device_id, 101 void DeviceReceiveEmptyBuffer(int device_id,
100 int buffer_id, 102 int buffer_id,
101 uint32 sync_point, 103 const gpu::SyncToken& release_sync_token,
102 double consumer_resource_utilization) { 104 double consumer_resource_utilization) {
103 received_buffer_count_++; 105 received_buffer_count_++;
104 } 106 }
105 107
106 void DeviceGetSupportedFormats(int device_id, 108 void DeviceGetSupportedFormats(int device_id,
107 media::VideoCaptureSessionId session_id) { 109 media::VideoCaptureSessionId session_id) {
108 // When the mock message filter receives a request for the device 110 // When the mock message filter receives a request for the device
109 // supported formats, replies immediately with an empty format list. 111 // supported formats, replies immediately with an empty format list.
110 OnDeviceSupportedFormatsEnumerated(media::VideoCaptureFormats()); 112 OnDeviceSupportedFormatsEnumerated(media::VideoCaptureFormats());
111 } 113 }
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 StartCapture(0, params_small_); 400 StartCapture(0, params_small_);
399 401
400 // Receive state change message from browser. 402 // Receive state change message from browser.
401 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR); 403 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR);
402 404
403 StopCapture(0); 405 StopCapture(0);
404 DeInit(); 406 DeInit();
405 } 407 }
406 408
407 } // namespace content 409 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698