Add autothread to pseudo-tcp fuzzer.

I think this will make a rtc::Thread object exist for the lifetime of
the environment, which will remove some uninteresting crashes.

BUG=chrome:648075

Review-Url: https://codereview.webrtc.org/2365373002
Cr-Commit-Position: refs/heads/master@{#14438}
This commit is contained in:
phoglund 2016-09-29 06:27:49 -07:00 committed by Commit bot
parent 70736e4c9d
commit 590cf281fb

View File

@ -11,6 +11,7 @@
#include <stddef.h>
#include <stdint.h>
#include "webrtc/base/thread.h"
#include "webrtc/p2p/base/pseudotcp.h"
namespace webrtc {
@ -29,10 +30,15 @@ class FakeIPseudoTcpNotify : public cricket::IPseudoTcpNotify {
};
struct Environment {
cricket::PseudoTcp* ptcp;
explicit Environment(cricket::IPseudoTcpNotify* notifier) {
ptcp = new cricket::PseudoTcp(notifier, 0);
explicit Environment(cricket::IPseudoTcpNotify* notifier):
ptcp(new cricket::PseudoTcp(notifier, 0)) {
}
cricket::PseudoTcp* const ptcp;
// We need the thread to avoid some uninteresting crashes, since the
// production code expects there to be a thread object available.
rtc::AutoThread thread;
};
Environment* env = new Environment(new FakeIPseudoTcpNotify());