| 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "media/audio/mock_audio_manager.h" | 31 #include "media/audio/mock_audio_manager.h" |
| 32 #include "media/base/media_switches.h" | 32 #include "media/base/media_switches.h" |
| 33 #include "media/capture/video_capture_types.h" | 33 #include "media/capture/video_capture_types.h" |
| 34 #include "mojo/public/cpp/bindings/binding.h" | 34 #include "mojo/public/cpp/bindings/binding.h" |
| 35 #include "net/url_request/url_request_context.h" | 35 #include "net/url_request/url_request_context.h" |
| 36 #include "testing/gmock/include/gmock/gmock.h" | 36 #include "testing/gmock/include/gmock/gmock.h" |
| 37 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
| 38 | 38 |
| 39 using ::testing::_; | 39 using ::testing::_; |
| 40 using ::testing::AnyNumber; | 40 using ::testing::AnyNumber; |
| 41 using ::testing::AtMost; |
| 41 using ::testing::DoAll; | 42 using ::testing::DoAll; |
| 42 using ::testing::InSequence; | 43 using ::testing::InSequence; |
| 43 using ::testing::Mock; | 44 using ::testing::Mock; |
| 44 using ::testing::Return; | 45 using ::testing::Return; |
| 45 using ::testing::SaveArg; | 46 using ::testing::SaveArg; |
| 46 using ::testing::StrictMock; | 47 using ::testing::StrictMock; |
| 47 | 48 |
| 48 namespace content { | 49 namespace content { |
| 49 | 50 |
| 50 namespace { | 51 namespace { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 void StartAndImmediateStopCapture() { | 238 void StartAndImmediateStopCapture() { |
| 238 // Quickly start and then stop capture, without giving much chance for | 239 // Quickly start and then stop capture, without giving much chance for |
| 239 // asynchronous capture operations to produce frames. | 240 // asynchronous capture operations to produce frames. |
| 240 InSequence s; | 241 InSequence s; |
| 241 base::RunLoop run_loop; | 242 base::RunLoop run_loop; |
| 242 | 243 |
| 243 media::VideoCaptureParams params; | 244 media::VideoCaptureParams params; |
| 244 params.requested_format = media::VideoCaptureFormat( | 245 params.requested_format = media::VideoCaptureFormat( |
| 245 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420); | 246 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420); |
| 246 | 247 |
| 247 EXPECT_CALL(*this, OnStateChanged(mojom::VideoCaptureState::STARTED)); | 248 // |STARTED| is reported asynchronously, which may not be received if |
| 249 // capture is stopped immediately. |
| 250 EXPECT_CALL(*this, OnStateChanged(mojom::VideoCaptureState::STARTED)) |
| 251 .Times(AtMost(1)); |
| 248 host_->Start(kDeviceId, opened_session_id_, params, | 252 host_->Start(kDeviceId, opened_session_id_, params, |
| 249 observer_binding_.CreateInterfacePtrAndBind()); | 253 observer_binding_.CreateInterfacePtrAndBind()); |
| 250 | 254 |
| 251 EXPECT_CALL(*this, OnStateChanged(mojom::VideoCaptureState::STOPPED)); | 255 EXPECT_CALL(*this, OnStateChanged(mojom::VideoCaptureState::STOPPED)); |
| 252 host_->Stop(kDeviceId); | 256 host_->Stop(kDeviceId); |
| 253 run_loop.RunUntilIdle(); | 257 run_loop.RunUntilIdle(); |
| 254 } | 258 } |
| 255 | 259 |
| 256 void PauseResumeCapture() { | 260 void PauseResumeCapture() { |
| 257 InSequence s; | 261 InSequence s; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 StartCapture(); | 362 StartCapture(); |
| 359 | 363 |
| 360 // When the session is closed via the stream without stopping capture, the | 364 // When the session is closed via the stream without stopping capture, the |
| 361 // ENDED event is sent. | 365 // ENDED event is sent. |
| 362 EXPECT_CALL(*this, OnStateChanged(mojom::VideoCaptureState::ENDED)); | 366 EXPECT_CALL(*this, OnStateChanged(mojom::VideoCaptureState::ENDED)); |
| 363 CloseSession(); | 367 CloseSession(); |
| 364 base::RunLoop().RunUntilIdle(); | 368 base::RunLoop().RunUntilIdle(); |
| 365 } | 369 } |
| 366 | 370 |
| 367 } // namespace content | 371 } // namespace content |
| OLD | NEW |