| Index: talk/media/base/videoengine_unittest.h
|
| diff --git a/talk/media/base/videoengine_unittest.h b/talk/media/base/videoengine_unittest.h
|
| index 5f00a0eca3c5399508667c93fc3c1257f265a6c5..8fc3729d87ddd318dd35751b43f5b06d3bc37dd7 100644
|
| --- a/talk/media/base/videoengine_unittest.h
|
| +++ b/talk/media/base/videoengine_unittest.h
|
| @@ -40,6 +40,10 @@
|
| #include "webrtc/base/gunit.h"
|
| #include "webrtc/base/timeutils.h"
|
|
|
| +#ifdef WIN32
|
| +#include <objbase.h> // NOLINT
|
| +#endif
|
| +
|
| #define EXPECT_FRAME_WAIT(c, w, h, t) \
|
| EXPECT_EQ_WAIT((c), renderer_.num_rendered_frames(), (t)); \
|
| EXPECT_EQ((w), renderer_.width()); \
|
| @@ -135,6 +139,28 @@ class VideoEngineTest : public testing::Test {
|
| engine_.Terminate();
|
| }
|
|
|
| +#ifdef WIN32
|
| + // Tests that the COM reference count is not munged by the engine.
|
| + // Test to make sure LMI does not munge the CoInitialize reference count.
|
| + void CheckCoInitialize() {
|
| + // Initial refcount should be 0.
|
| + EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED));
|
| +
|
| + // Engine should start even with COM already inited.
|
| + EXPECT_TRUE(engine_.Init(rtc::Thread::Current()));
|
| + engine_.Terminate();
|
| + // Refcount after terminate should be 1; this tests if it is nonzero.
|
| + EXPECT_EQ(S_FALSE, CoInitializeEx(NULL, COINIT_MULTITHREADED));
|
| + // Decrement refcount to (hopefully) 0.
|
| + CoUninitialize();
|
| + CoUninitialize();
|
| +
|
| + // Ensure refcount is 0.
|
| + EXPECT_EQ(S_OK, CoInitializeEx(NULL, COINIT_MULTITHREADED));
|
| + CoUninitialize();
|
| + }
|
| +#endif
|
| +
|
| void ConstrainNewCodecBody() {
|
| cricket::VideoCodec empty, in, out;
|
| cricket::VideoCodec max_settings(engine_.codecs()[0].id,
|
|
|