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

Side by Side Diff: talk/media/base/videoengine_unittest.h

Issue 1309313008: Revert "Move test cases for more natural ordering" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | talk/media/webrtc/webrtcvideoengine2_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 2014 Google Inc. 3 * Copyright 2014 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 22 matching lines...) Expand all
33 33
34 #include "talk/media/base/fakenetworkinterface.h" 34 #include "talk/media/base/fakenetworkinterface.h"
35 #include "talk/media/base/fakevideocapturer.h" 35 #include "talk/media/base/fakevideocapturer.h"
36 #include "talk/media/base/fakevideorenderer.h" 36 #include "talk/media/base/fakevideorenderer.h"
37 #include "talk/media/base/mediachannel.h" 37 #include "talk/media/base/mediachannel.h"
38 #include "talk/media/base/streamparams.h" 38 #include "talk/media/base/streamparams.h"
39 #include "webrtc/base/bytebuffer.h" 39 #include "webrtc/base/bytebuffer.h"
40 #include "webrtc/base/gunit.h" 40 #include "webrtc/base/gunit.h"
41 #include "webrtc/base/timeutils.h" 41 #include "webrtc/base/timeutils.h"
42 42
43 #ifdef WIN32
44 #include <objbase.h> // NOLINT
45 #endif
46
43 #define EXPECT_FRAME_WAIT(c, w, h, t) \ 47 #define EXPECT_FRAME_WAIT(c, w, h, t) \
44 EXPECT_EQ_WAIT((c), renderer_.num_rendered_frames(), (t)); \ 48 EXPECT_EQ_WAIT((c), renderer_.num_rendered_frames(), (t)); \
45 EXPECT_EQ((w), renderer_.width()); \ 49 EXPECT_EQ((w), renderer_.width()); \
46 EXPECT_EQ((h), renderer_.height()); \ 50 EXPECT_EQ((h), renderer_.height()); \
47 EXPECT_EQ(0, renderer_.errors()); \ 51 EXPECT_EQ(0, renderer_.errors()); \
48 52
49 #define EXPECT_FRAME_ON_RENDERER_WAIT(r, c, w, h, t) \ 53 #define EXPECT_FRAME_ON_RENDERER_WAIT(r, c, w, h, t) \
50 EXPECT_EQ_WAIT((c), (r).num_rendered_frames(), (t)); \ 54 EXPECT_EQ_WAIT((c), (r).num_rendered_frames(), (t)); \
51 EXPECT_EQ((w), (r).width()); \ 55 EXPECT_EQ((w), (r).width()); \
52 EXPECT_EQ((h), (r).height()); \ 56 EXPECT_EQ((h), (r).height()); \
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 protected: 132 protected:
129 // Tests starting and stopping the engine, and creating a channel. 133 // Tests starting and stopping the engine, and creating a channel.
130 void StartupShutdown() { 134 void StartupShutdown() {
131 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); 135 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
132 cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL); 136 cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL);
133 EXPECT_TRUE(channel != NULL); 137 EXPECT_TRUE(channel != NULL);
134 delete channel; 138 delete channel;
135 engine_.Terminate(); 139 engine_.Terminate();
136 } 140 }
137 141
142 #ifdef WIN32
143 // Tests that the COM reference count is not munged by the engine.
144 // Test to make sure LMI does not munge the CoInitialize reference count.
145 void CheckCoInitialize() {
146 // Initial refcount should be 0.
147 EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED));
148
149 // Engine should start even with COM already inited.
150 EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
151 engine_.Terminate();
152 // Refcount after terminate should be 1; this tests if it is nonzero.
153 EXPECT_EQ(S_FALSE, CoInitializeEx(NULL, COINIT_MULTITHREADED));
154 // Decrement refcount to (hopefully) 0.
155 CoUninitialize();
156 CoUninitialize();
157
158 // Ensure refcount is 0.
159 EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED));
160 CoUninitialize();
161 }
162 #endif
163
138 void ConstrainNewCodecBody() { 164 void ConstrainNewCodecBody() {
139 cricket::VideoCodec empty, in, out; 165 cricket::VideoCodec empty, in, out;
140 cricket::VideoCodec max_settings(engine_.codecs()[0].id, 166 cricket::VideoCodec max_settings(engine_.codecs()[0].id,
141 engine_.codecs()[0].name, 167 engine_.codecs()[0].name,
142 1280, 800, 30, 0); 168 1280, 800, 30, 0);
143 169
144 // set max settings of 1280x800x30 170 // set max settings of 1280x800x30
145 EXPECT_TRUE(engine_.SetDefaultEncoderConfig( 171 EXPECT_TRUE(engine_.SetDefaultEncoderConfig(
146 cricket::VideoEncoderConfig(max_settings))); 172 cricket::VideoEncoderConfig(max_settings)));
147 173
(...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 rtc::scoped_ptr<C> channel_; 1906 rtc::scoped_ptr<C> channel_;
1881 cricket::FakeNetworkInterface network_interface_; 1907 cricket::FakeNetworkInterface network_interface_;
1882 cricket::FakeVideoRenderer renderer_; 1908 cricket::FakeVideoRenderer renderer_;
1883 cricket::VideoMediaChannel::Error media_error_; 1909 cricket::VideoMediaChannel::Error media_error_;
1884 1910
1885 // Used by test cases where 2 streams are run on the same channel. 1911 // Used by test cases where 2 streams are run on the same channel.
1886 cricket::FakeVideoRenderer renderer2_; 1912 cricket::FakeVideoRenderer renderer2_;
1887 }; 1913 };
1888 1914
1889 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT 1915 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT
OLDNEW
« no previous file with comments | « no previous file | talk/media/webrtc/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698