OLD | NEW |
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 // Unit test for VideoCaptureController. | 5 // Unit test for VideoCaptureController. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 base::Unretained(controller_), id, this)); | 103 base::Unretained(controller_), id, this)); |
104 } | 104 } |
105 | 105 |
106 VideoCaptureController* controller_; | 106 VideoCaptureController* controller_; |
107 }; | 107 }; |
108 | 108 |
109 // Test class. | 109 // Test class. |
110 class VideoCaptureControllerTest : public testing::Test { | 110 class VideoCaptureControllerTest : public testing::Test { |
111 public: | 111 public: |
112 VideoCaptureControllerTest() {} | 112 VideoCaptureControllerTest() {} |
113 virtual ~VideoCaptureControllerTest() {} | 113 ~VideoCaptureControllerTest() override {} |
114 | 114 |
115 protected: | 115 protected: |
116 static const int kPoolSize = 3; | 116 static const int kPoolSize = 3; |
117 | 117 |
118 virtual void SetUp() override { | 118 void SetUp() override { |
119 controller_.reset(new VideoCaptureController(kPoolSize)); | 119 controller_.reset(new VideoCaptureController(kPoolSize)); |
120 device_ = controller_->NewDeviceClient().Pass(); | 120 device_ = controller_->NewDeviceClient().Pass(); |
121 client_a_.reset(new MockVideoCaptureControllerEventHandler( | 121 client_a_.reset(new MockVideoCaptureControllerEventHandler( |
122 controller_.get())); | 122 controller_.get())); |
123 client_b_.reset(new MockVideoCaptureControllerEventHandler( | 123 client_b_.reset(new MockVideoCaptureControllerEventHandler( |
124 controller_.get())); | 124 controller_.get())); |
125 } | 125 } |
126 | 126 |
127 virtual void TearDown() override { | 127 void TearDown() override { base::RunLoop().RunUntilIdle(); } |
128 base::RunLoop().RunUntilIdle(); | |
129 } | |
130 | 128 |
131 scoped_refptr<media::VideoFrame> WrapI420Buffer( | 129 scoped_refptr<media::VideoFrame> WrapI420Buffer( |
132 const scoped_refptr<media::VideoCaptureDevice::Client::Buffer>& buffer, | 130 const scoped_refptr<media::VideoCaptureDevice::Client::Buffer>& buffer, |
133 gfx::Size dimensions) { | 131 gfx::Size dimensions) { |
134 return media::VideoFrame::WrapExternalPackedMemory( | 132 return media::VideoFrame::WrapExternalPackedMemory( |
135 media::VideoFrame::I420, | 133 media::VideoFrame::I420, |
136 dimensions, | 134 dimensions, |
137 gfx::Rect(dimensions), | 135 gfx::Rect(dimensions), |
138 dimensions, | 136 dimensions, |
139 reinterpret_cast<uint8*>(buffer->data()), | 137 reinterpret_cast<uint8*>(buffer->data()), |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 | 633 |
636 // Second client connects after the error state. It also should get told of | 634 // Second client connects after the error state. It also should get told of |
637 // the error. | 635 // the error. |
638 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); | 636 EXPECT_CALL(*client_b_, DoError(route_id)).Times(1); |
639 controller_->AddClient( | 637 controller_->AddClient( |
640 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); | 638 route_id, client_b_.get(), base::kNullProcessHandle, 200, session_200); |
641 Mock::VerifyAndClearExpectations(client_b_.get()); | 639 Mock::VerifyAndClearExpectations(client_b_.get()); |
642 } | 640 } |
643 | 641 |
644 } // namespace content | 642 } // namespace content |
OLD | NEW |