libreoffice-online/loolwsd/test/UnitFuzz.cpp
2016-09-01 10:11:03 +01:00

75 lines
1.6 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <dlfcn.h>
#include <ftw.h>
#include <cassert>
#include <iostream>
#include <sys/types.h>
#include <dirent.h>
#include "Common.hpp"
#include "IoUtil.hpp"
#include "LOOLProtocol.hpp"
#include "Unit.hpp"
#include "Util.hpp"
#include <Poco/Timestamp.h>
#include <Poco/StringTokenizer.h>
#include <Poco/Net/WebSocket.h>
// Inside the WSD process
class UnitFuzz : public UnitWSD
{
public:
UnitFuzz()
{
std::cerr << "UnitFuzz startup\n";
setHasKitHooks();
}
virtual bool filterHandleRequest(
TestRequest /* type */,
Poco::Net::HTTPServerRequest& /* request */,
Poco::Net::HTTPServerResponse& /* response */) override
{
return false;
}
};
// Inside the forkit & kit processes
class UnitKitFuzz : public UnitKit
{
public:
UnitKitFuzz()
{
std::cerr << "UnitKit Fuzz init !\n";
}
~UnitKitFuzz()
{
}
virtual bool filterKitMessage(const std::shared_ptr<Poco::Net::WebSocket> & /* ws */,
std::string & /* message */) override
{
return false;
}
};
UnitBase *unit_create_wsd(void)
{
return new UnitFuzz();
}
UnitBase *unit_create_kit(void)
{
return new UnitKitFuzz();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */