/usr/include/Wt/Test/WTestEnvironment is in libwt-dev 3.1.10-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WTEST_ENVIRONMENT_H_
#define WTEST_ENVIRONMENT_H_
#include <string>
#include <map>
#include <vector>
#include <Wt/WEnvironment>
#include <Wt/WServer>
namespace Wt {
class WebController;
class Configuration;
namespace Test {
/*! \class WTestEnvironment Wt/Test/WTestEnvironment Wt/Test/WTestEnvironment
* \brief An environment for testing purposes.
*
* This environment is useful for use in automated (integration/unit)
* tests: you may configure its properties and pass it to the
* constructor of an application.
*
* This is useful for automated test-cases:
* \if cpp
* \code
* void testX() {
* Test::WTestEnvironment environment;
* MyApplication app(environment);
* ...
* }
* \endcode
* \elseif java
* \code
* void testX() {
* WTestEnvironment environment(new Configuration());
* MyApplication app(environment);
* ...
* }
* \endcode
* \endif
*
* \sa WEnvironment, WApplication::WApplication(const WEnvironment&)
*/
class WT_API WTestEnvironment : public WEnvironment
{
public:
#ifndef WT_TARGET_JAVA
/*! \brief Default constructor.
*
* Constructs a test environment that resembles FireFox 3.0 with default
* settings.
*
* The <i>applicationPath</i> is the simulated deployment path. The
* configuration file points to a wt_config.xml configuration file.
* The <i>type</i> indicates the application type.
*
* After construction, but before passing it to the constructor of a
* WApplication, you can change any of the environment properties using
* the setter methods.
*/
WTestEnvironment(const std::string& applicationPath = "/",
const std::string& configurationFile = "",
EntryPointType type = Application);
#else
/*! \brief Default constructor.
*
* Constructs a test environment that resembles FireFox 3.0 with default
* settings.
*
* After construction, but before passing it to the constructor of a
* WApplication, you can change any of the environment properties using
* the setter methods.
*/
WTestEnvironment(Configuration *configuration,
EntryPointType type = Application);
#endif // WT_TARGET_JAVA
/**! \brief Destructor.
*/
~WTestEnvironment();
/** \brief Sets parameters to the application.
*
* The default value is an empty map.
*
* \sa getParameterMap()
*/
void setParameterMap(const Http::ParameterMap& parameters);
/** \brief Sets HTTP cookies.
*
* The default value is an empty map.
*
* \sa cookies()
*/
void setCookies(const CookieMap& cookies);
/** \brief Sets a HTTP header value.
*
* The default value is no headers.
*
* \sa headerValue()
*/
void setHeaderValue(const std::string& value);
/** \brief Sets whether cookies are supported.
*
* The default value is <i>true</i>.
*
* \sa supportsCookies()
*/
void setSupportsCookies(bool enabled);
/** \brief Sets whether AJAX is supported.
*
* The default value is <i>true</i>.
*
* \sa ajax()
*/
void setAjax(bool enabled);
/** \brief Sets the display's DPI scale.
*
* The default value is 1.
*
* \sa dpiScale()
*/
void setDpiScale(double dpiScale);
/** \brief Sets the locale.
*
* The default value is "en".
*
* \sa locale()
*/
void setLocale(const WT_LOCALE& locale);
/** \brief Sets the host name.
*
* The default value is "localhost".
*
* \sa hostName()
*/
void setHostName(const std::string& hostName);
/** \brief Sets the URL scheme.
*
* The default value is "http".
*
* \sa urlScheme()
*/
void setUrlScheme(const std::string& scheme);
/** \brief Sets the user agent.
*
* The default value is no "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.11) Gecko/2009060309 Ubuntu/9.04 (jaunty) Firefox/3.0.11".
*
* \sa userAgent()
*/
void setUserAgent(const std::string& userAgent);
/** \brief Sets the referer.
*
* The default value is "".
*
* \sa referer()
*/
void setReferer(const std::string& referer);
/** \brief Sets the accept header.
*
* \htmlonly
* The default value is
* "text/html,application/xhtml+xml,application/xml;q=0.9,*<span>/</span>*;q=0.8".
* \endhtmlonly
*
* \sa accept()
*/
void setAccept(const std::string& accept);
/** \brief Sets the server signature.
*
* The default value is "None (WTestEnvironment)".
*
* \sa serverSignature()
*/
void setServerSignature(const std::string& signature);
/** \brief Sets the server software.
*
* The default value is "None (WTestEnvironment)".
*
* \sa serverSoftware()
*/
void setServerSoftware(const std::string& software);
/** \brief Sets the server admin.
*
* The default value is "your@onyourown.here".
*
* \sa serverAdmin()
*/
void setServerAdmin(const std::string& serverAdmin);
/** \brief Sets the client address.
*
* The default value is "127.0.0.1".
*
* \sa clientAddress()
*/
void setClientAddress(const std::string& clientAddress);
/** \brief Sets the initial internal path.
*
* The default value is "".
*
* \sa internalPath()
*/
void setInternalPath(const std::string& internalPath);
/** \brief Sets the content type.
*
* The default value is XHTML1.
*
* \sa contentType()
*/
void setContentType(ContentType contentType);
private:
Configuration *configuration_;
boost::shared_ptr<WebSession> theSession_;
WebController *controller_;
void init(EntryPointType type);
};
}
}
#endif // WTEST_ENVIRONMENT_H_
|