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

Side by Side Diff: talk/media/webrtc/webrtcvideocapturer_unittest.cc

Issue 1485673003: WebRtcVideoCapturer: SetCaptureState(CS_STOPPED) on Stop and ensure state changes in unittest (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « talk/media/webrtc/webrtcvideocapturer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 EXPECT_EQ_WAIT(cricket::CS_RUNNING, listener_.last_capture_state(), 1000); 104 EXPECT_EQ_WAIT(cricket::CS_RUNNING, listener_.last_capture_state(), 1000);
105 EXPECT_TRUE(factory_->modules[0]->SendFrame(640, 480)); 105 EXPECT_TRUE(factory_->modules[0]->SendFrame(640, 480));
106 EXPECT_TRUE_WAIT(listener_.frame_count() > 0, 5000); 106 EXPECT_TRUE_WAIT(listener_.frame_count() > 0, 5000);
107 EXPECT_EQ(capturer_->GetCaptureFormat()->fourcc, listener_.frame_fourcc()); 107 EXPECT_EQ(capturer_->GetCaptureFormat()->fourcc, listener_.frame_fourcc());
108 EXPECT_EQ(640, listener_.frame_width()); 108 EXPECT_EQ(640, listener_.frame_width());
109 EXPECT_EQ(480, listener_.frame_height()); 109 EXPECT_EQ(480, listener_.frame_height());
110 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); 110 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format));
111 capturer_->Stop(); 111 capturer_->Stop();
112 EXPECT_FALSE(capturer_->IsRunning()); 112 EXPECT_FALSE(capturer_->IsRunning());
113 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); 113 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL);
114 EXPECT_EQ_WAIT(cricket::CS_STOPPED, listener_.last_capture_state(), 1000);
114 } 115 }
115 116
116 TEST_F(WebRtcVideoCapturerTest, TestCaptureVcm) { 117 TEST_F(WebRtcVideoCapturerTest, TestCaptureVcm) {
117 EXPECT_TRUE(capturer_->Init(factory_->Create(0, 118 EXPECT_TRUE(capturer_->Init(factory_->Create(0,
118 reinterpret_cast<const char*>(kTestDeviceId.c_str())))); 119 reinterpret_cast<const char*>(kTestDeviceId.c_str()))));
119 EXPECT_TRUE(capturer_->GetSupportedFormats()->empty()); 120 EXPECT_TRUE(capturer_->GetSupportedFormats()->empty());
120 VideoFormat format; 121 VideoFormat format;
121 EXPECT_TRUE(capturer_->GetBestCaptureFormat(kDefaultVideoFormat, &format)); 122 EXPECT_TRUE(capturer_->GetBestCaptureFormat(kDefaultVideoFormat, &format));
122 EXPECT_EQ(kDefaultVideoFormat.width, format.width); 123 EXPECT_EQ(kDefaultVideoFormat.width, format.width);
123 EXPECT_EQ(kDefaultVideoFormat.height, format.height); 124 EXPECT_EQ(kDefaultVideoFormat.height, format.height);
(...skipping 14 matching lines...) Expand all
138 EXPECT_FALSE(capturer_->IsRunning()); 139 EXPECT_FALSE(capturer_->IsRunning());
139 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); 140 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL);
140 } 141 }
141 142
142 TEST_F(WebRtcVideoCapturerTest, TestCaptureWithoutInit) { 143 TEST_F(WebRtcVideoCapturerTest, TestCaptureWithoutInit) {
143 cricket::VideoFormat format; 144 cricket::VideoFormat format;
144 EXPECT_EQ(cricket::CS_NO_DEVICE, capturer_->Start(format)); 145 EXPECT_EQ(cricket::CS_NO_DEVICE, capturer_->Start(format));
145 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); 146 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL);
146 EXPECT_FALSE(capturer_->IsRunning()); 147 EXPECT_FALSE(capturer_->IsRunning());
147 } 148 }
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvideocapturer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698