OLD | NEW |
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void OnLocalFrameFormat(cricket::VideoCapturer*, | 120 void OnLocalFrameFormat(cricket::VideoCapturer*, |
121 const cricket::VideoFormat*) { | 121 const cricket::VideoFormat*) { |
122 } | 122 } |
123 | 123 |
124 void TriggerMediaFrame( | 124 void TriggerMediaFrame( |
125 uint32 ssrc, cricket::VideoFrame* frame, bool* drop_frame) { | 125 uint32 ssrc, cricket::VideoFrame* frame, bool* drop_frame) { |
126 T::SignalMediaFrame(ssrc, frame, drop_frame); | 126 T::SignalMediaFrame(ssrc, frame, drop_frame); |
127 } | 127 } |
128 }; | 128 }; |
129 | 129 |
130 // Macroes that declare test functions for a given test class, before and after | |
131 // Init(). | |
132 // To use, define a test function called FooBody and pass Foo to the macro. | |
133 #define TEST_PRE_VIDEOENGINE_INIT(TestClass, func) \ | |
134 TEST_F(TestClass, func##PreInit) { \ | |
135 func##Body(); \ | |
136 } | |
137 #define TEST_POST_VIDEOENGINE_INIT(TestClass, func) \ | |
138 TEST_F(TestClass, func##PostInit) { \ | |
139 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); \ | |
140 func##Body(); \ | |
141 engine_.Terminate(); \ | |
142 } | |
143 | |
144 template<class E> | 130 template<class E> |
145 class VideoEngineTest : public testing::Test { | 131 class VideoEngineTest : public testing::Test { |
146 protected: | 132 protected: |
147 // Tests starting and stopping the engine, and creating a channel. | 133 // Tests starting and stopping the engine, and creating a channel. |
148 void StartupShutdown() { | 134 void StartupShutdown() { |
149 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); | 135 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); |
150 cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL); | 136 cricket::VideoMediaChannel* channel = engine_.CreateChannel(NULL); |
151 EXPECT_TRUE(channel != NULL); | 137 EXPECT_TRUE(channel != NULL); |
152 delete channel; | 138 delete channel; |
153 engine_.Terminate(); | 139 engine_.Terminate(); |
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1920 rtc::scoped_ptr<C> channel_; | 1906 rtc::scoped_ptr<C> channel_; |
1921 cricket::FakeNetworkInterface network_interface_; | 1907 cricket::FakeNetworkInterface network_interface_; |
1922 cricket::FakeVideoRenderer renderer_; | 1908 cricket::FakeVideoRenderer renderer_; |
1923 cricket::VideoMediaChannel::Error media_error_; | 1909 cricket::VideoMediaChannel::Error media_error_; |
1924 | 1910 |
1925 // 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. |
1926 cricket::FakeVideoRenderer renderer2_; | 1912 cricket::FakeVideoRenderer renderer2_; |
1927 }; | 1913 }; |
1928 | 1914 |
1929 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT | 1915 #endif // TALK_MEDIA_BASE_VIDEOENGINE_UNITTEST_H_ NOLINT |
OLD | NEW |