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

Side by Side Diff: webrtc/voice_engine/test/auto_test/fixtures/after_initialization_fixture.h

Issue 1469013002: Move ThreadWrapper to ProcessThread in base. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: removed comment 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_ 11 #ifndef SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_
12 #define SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_ 12 #define SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_
13 13
14 #include <deque> 14 #include <deque>
15 15
16 #include "webrtc/base/platform_thread.h"
16 #include "webrtc/base/scoped_ptr.h" 17 #include "webrtc/base/scoped_ptr.h"
17 #include "webrtc/common_types.h" 18 #include "webrtc/common_types.h"
18 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 19 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
19 #include "webrtc/system_wrappers/include/atomic32.h" 20 #include "webrtc/system_wrappers/include/atomic32.h"
20 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
21 #include "webrtc/system_wrappers/include/event_wrapper.h" 22 #include "webrtc/system_wrappers/include/event_wrapper.h"
22 #include "webrtc/system_wrappers/include/sleep.h" 23 #include "webrtc/system_wrappers/include/sleep.h"
23 #include "webrtc/system_wrappers/include/thread_wrapper.h"
24 #include "webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixt ure.h" 24 #include "webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixt ure.h"
25 25
26 class TestErrorObserver; 26 class TestErrorObserver;
27 27
28 class LoopBackTransport : public webrtc::Transport { 28 class LoopBackTransport : public webrtc::Transport {
29 public: 29 public:
30 LoopBackTransport(webrtc::VoENetwork* voe_network, int channel) 30 LoopBackTransport(webrtc::VoENetwork* voe_network, int channel)
31 : crit_(webrtc::CriticalSectionWrapper::CreateCriticalSection()), 31 : crit_(webrtc::CriticalSectionWrapper::CreateCriticalSection()),
32 packet_event_(webrtc::EventWrapper::Create()), 32 packet_event_(webrtc::EventWrapper::Create()),
33 thread_(webrtc::ThreadWrapper::CreateThread(NetworkProcess, 33 thread_(webrtc::PlatformThread::CreateThread(NetworkProcess,
34 this, 34 this,
35 "LoopBackTransport")), 35 "LoopBackTransport")),
36 channel_(channel), 36 channel_(channel),
37 voe_network_(voe_network), 37 voe_network_(voe_network),
38 transmitted_packets_(0) { 38 transmitted_packets_(0) {
39 thread_->Start(); 39 thread_->Start();
40 } 40 }
41 41
42 ~LoopBackTransport() { thread_->Stop(); } 42 ~LoopBackTransport() { thread_->Stop(); }
43 43
44 bool SendRtp(const uint8_t* data, 44 bool SendRtp(const uint8_t* data,
45 size_t len, 45 size_t len,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 voe_network_->ReceivedRTCPPacket(channel, p.data, p.len); 140 voe_network_->ReceivedRTCPPacket(channel, p.data, p.len);
141 break; 141 break;
142 } 142 }
143 ++transmitted_packets_; 143 ++transmitted_packets_;
144 } 144 }
145 return true; 145 return true;
146 } 146 }
147 147
148 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> crit_; 148 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> crit_;
149 const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_; 149 const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_;
150 const rtc::scoped_ptr<webrtc::ThreadWrapper> thread_; 150 const rtc::scoped_ptr<webrtc::PlatformThread> thread_;
151 std::deque<Packet> packet_queue_ GUARDED_BY(crit_.get()); 151 std::deque<Packet> packet_queue_ GUARDED_BY(crit_.get());
152 const int channel_; 152 const int channel_;
153 std::map<uint32_t, int> channels_ GUARDED_BY(crit_.get()); 153 std::map<uint32_t, int> channels_ GUARDED_BY(crit_.get());
154 webrtc::VoENetwork* const voe_network_; 154 webrtc::VoENetwork* const voe_network_;
155 webrtc::Atomic32 transmitted_packets_; 155 webrtc::Atomic32 transmitted_packets_;
156 }; 156 };
157 157
158 // This fixture initializes the voice engine in addition to the work 158 // This fixture initializes the voice engine in addition to the work
159 // done by the before-initialization fixture. It also registers an error 159 // done by the before-initialization fixture. It also registers an error
160 // observer which will fail tests on error callbacks. This fixture is 160 // observer which will fail tests on error callbacks. This fixture is
161 // useful to tests that want to run before we have started any form of 161 // useful to tests that want to run before we have started any form of
162 // streaming through the voice engine. 162 // streaming through the voice engine.
163 class AfterInitializationFixture : public BeforeInitializationFixture { 163 class AfterInitializationFixture : public BeforeInitializationFixture {
164 public: 164 public:
165 AfterInitializationFixture(); 165 AfterInitializationFixture();
166 virtual ~AfterInitializationFixture(); 166 virtual ~AfterInitializationFixture();
167 167
168 protected: 168 protected:
169 rtc::scoped_ptr<TestErrorObserver> error_observer_; 169 rtc::scoped_ptr<TestErrorObserver> error_observer_;
170 }; 170 };
171 171
172 #endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_ 172 #endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698