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

Side by Side Diff: content/browser/renderer_host/media/video_capture_unittest.cc

Issue 2673373003: getUserMeida: report device starting states (Closed)
Patch Set: Created 3 years, 10 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 <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
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
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 now, which may not be got if capture
249 // is stopped immediately.
chfremer 2017/02/16 01:00:50 Please remove the "now", because the reader of the
braveyao 2017/02/17 20:37:21 Done.
250 EXPECT_CALL(*this, OnStateChanged(mojom::VideoCaptureState::STARTED))
251 .Times(AtMost(1));
chfremer 2017/02/09 23:34:52 Do we really want to modify the contract between V
braveyao 2017/02/14 01:05:49 It's natural to me that a stop request can cancel
chfremer 2017/02/14 19:21:22 I think it is confusing for the listener when a ST
braveyao 2017/02/15 21:47:15 As we discussed, the current processing is OK. Kee
chfremer 2017/02/16 01:00:50 As per our offline discussion, I understand that t
braveyao 2017/02/17 20:37:20 Done.
chfremer 2017/02/17 23:51:14 I couldn't find this change in PatchSet#6. Also no
braveyao 2017/02/22 18:06:44 "InSequence" is in this function already, at line
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698