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

Side by Side Diff: talk/media/base/capturemanager_unittest.cc

Issue 1405023016: Convert usage of ARRAY_SIZE to arraysize. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: static_cast<int> 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
« no previous file with comments | « talk/app/webrtc/webrtcsdp.cc ('k') | talk/media/base/streamparams_unittest.cc » ('j') | 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 2012 Google Inc. 3 * Copyright 2012 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 11 matching lines...) Expand all
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "talk/media/base/capturemanager.h" 28 #include "talk/media/base/capturemanager.h"
29 29
30 #include "talk/media/base/fakevideocapturer.h" 30 #include "talk/media/base/fakevideocapturer.h"
31 #include "talk/media/base/fakevideorenderer.h" 31 #include "talk/media/base/fakevideorenderer.h"
32 #include "webrtc/base/arraysize.h"
32 #include "webrtc/base/gunit.h" 33 #include "webrtc/base/gunit.h"
33 #include "webrtc/base/sigslot.h" 34 #include "webrtc/base/sigslot.h"
34 35
35 const int kMsCallbackWait = 50; 36 const int kMsCallbackWait = 50;
36 37
37 const int kFps = 30; 38 const int kFps = 30;
38 const cricket::VideoFormatPod kCameraFormats[] = { 39 const cricket::VideoFormatPod kCameraFormats[] = {
39 {640, 480, cricket::VideoFormat::FpsToInterval(kFps), cricket::FOURCC_I420}, 40 {640, 480, cricket::VideoFormat::FpsToInterval(kFps), cricket::FOURCC_I420},
40 {320, 240, cricket::VideoFormat::FpsToInterval(kFps), cricket::FOURCC_I420} 41 {320, 240, cricket::VideoFormat::FpsToInterval(kFps), cricket::FOURCC_I420}
41 }; 42 };
42 43
43 class CaptureManagerTest : public ::testing::Test, public sigslot::has_slots<> { 44 class CaptureManagerTest : public ::testing::Test, public sigslot::has_slots<> {
44 public: 45 public:
45 CaptureManagerTest() 46 CaptureManagerTest()
46 : capture_manager_(), 47 : capture_manager_(),
47 callback_count_(0), 48 callback_count_(0),
48 format_vga_(kCameraFormats[0]), 49 format_vga_(kCameraFormats[0]),
49 format_qvga_(kCameraFormats[1]) { 50 format_qvga_(kCameraFormats[1]) {
50 } 51 }
51 virtual void SetUp() { 52 virtual void SetUp() {
52 PopulateSupportedFormats(); 53 PopulateSupportedFormats();
53 capture_state_ = cricket::CS_STOPPED; 54 capture_state_ = cricket::CS_STOPPED;
54 capture_manager_.SignalCapturerStateChange.connect( 55 capture_manager_.SignalCapturerStateChange.connect(
55 this, 56 this,
56 &CaptureManagerTest::OnCapturerStateChange); 57 &CaptureManagerTest::OnCapturerStateChange);
57 } 58 }
58 void PopulateSupportedFormats() { 59 void PopulateSupportedFormats() {
59 std::vector<cricket::VideoFormat> formats; 60 std::vector<cricket::VideoFormat> formats;
60 for (int i = 0; i < ARRAY_SIZE(kCameraFormats); ++i) { 61 for (int i = 0; i < arraysize(kCameraFormats); ++i) {
61 formats.push_back(cricket::VideoFormat(kCameraFormats[i])); 62 formats.push_back(cricket::VideoFormat(kCameraFormats[i]));
62 } 63 }
63 video_capturer_.ResetSupportedFormats(formats); 64 video_capturer_.ResetSupportedFormats(formats);
64 } 65 }
65 int NumFramesRendered() { return video_renderer_.num_rendered_frames(); } 66 int NumFramesRendered() { return video_renderer_.num_rendered_frames(); }
66 bool WasRenderedResolution(cricket::VideoFormat format) { 67 bool WasRenderedResolution(cricket::VideoFormat format) {
67 return format.width == video_renderer_.width() && 68 return format.width == video_renderer_.width() &&
68 format.height == video_renderer_.height(); 69 format.height == video_renderer_.height();
69 } 70 }
70 cricket::CaptureState capture_state() { return capture_state_; } 71 cricket::CaptureState capture_state() { return capture_state_; }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // Now request restart with qvga. 220 // Now request restart with qvga.
220 EXPECT_TRUE(capture_manager_.RestartVideoCapture( 221 EXPECT_TRUE(capture_manager_.RestartVideoCapture(
221 &video_capturer_, format_vga_, format_qvga_, 222 &video_capturer_, format_vga_, format_qvga_,
222 cricket::CaptureManager::kRequestRestart)); 223 cricket::CaptureManager::kRequestRestart));
223 EXPECT_TRUE(video_capturer_.CaptureFrame()); 224 EXPECT_TRUE(video_capturer_.CaptureFrame());
224 EXPECT_EQ(2, NumFramesRendered()); 225 EXPECT_EQ(2, NumFramesRendered());
225 EXPECT_TRUE(WasRenderedResolution(format_vga_)); 226 EXPECT_TRUE(WasRenderedResolution(format_vga_));
226 EXPECT_TRUE(capture_manager_.StopVideoCapture(&video_capturer_, 227 EXPECT_TRUE(capture_manager_.StopVideoCapture(&video_capturer_,
227 format_qvga_)); 228 format_qvga_));
228 } 229 }
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsdp.cc ('k') | talk/media/base/streamparams_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698