Skip to content
Snippets Groups Projects
Commit 36f094d5 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

MAINT-2168: Backed out changeset fb93eecd462d, reapply fix

Now that we've backed out the premature push, reapply the actual fix to
propagate it appropriately.
parent 144fcf62
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
namespace tut namespace tut
{ {
LLSD storage; LLSD storage;
class LLSDStorageNode : public LLHTTPNode class LLSDStorageNode : public LLHTTPNode
{ {
public: public:
...@@ -82,8 +82,13 @@ namespace tut ...@@ -82,8 +82,13 @@ namespace tut
{ {
public: public:
HTTPClientTestData(): HTTPClientTestData():
local_server(STRINGIZE("http://127.0.0.1:" << getenv("PORT") << "/")) PORT(getenv("PORT")),
// Turning NULL PORT into empty string doesn't make things work;
// that's just to keep this initializer from blowing up. We test
// PORT separately in the constructor body.
local_server(STRINGIZE("http://127.0.0.1:" << (PORT? PORT : "") << "/"))
{ {
ensure("Set environment variable PORT to local test server port", PORT);
apr_pool_create(&mPool, NULL); apr_pool_create(&mPool, NULL);
LLCurl::initClass(false); LLCurl::initClass(false);
mServerPump = new LLPumpIO(mPool); mServerPump = new LLPumpIO(mPool);
...@@ -91,7 +96,7 @@ namespace tut ...@@ -91,7 +96,7 @@ namespace tut
LLHTTPClient::setPump(*mClientPump); LLHTTPClient::setPump(*mClientPump);
} }
~HTTPClientTestData() ~HTTPClientTestData()
{ {
delete mServerPump; delete mServerPump;
...@@ -107,7 +112,7 @@ namespace tut ...@@ -107,7 +112,7 @@ namespace tut
LLHTTPStandardServices::useServices(); LLHTTPStandardServices::useServices();
LLHTTPRegistrar::buildAllServices(root); LLHTTPRegistrar::buildAllServices(root);
} }
void runThePump(float timeout = 100.0f) void runThePump(float timeout = 100.0f)
{ {
LLTimer timer; LLTimer timer;
...@@ -134,6 +139,7 @@ namespace tut ...@@ -134,6 +139,7 @@ namespace tut
mServerPump = NULL; mServerPump = NULL;
} }
const char* const PORT;
const std::string local_server; const std::string local_server;
private: private:
...@@ -148,11 +154,11 @@ namespace tut ...@@ -148,11 +154,11 @@ namespace tut
{ {
std::string msg = std::string msg =
llformat("error() called when not expected, status %d", llformat("error() called when not expected, status %d",
mStatus); mStatus);
fail(msg); fail(msg);
} }
} }
void ensureStatusError() void ensureStatusError()
{ {
if (!mSawError) if (!mSawError)
...@@ -160,7 +166,7 @@ namespace tut ...@@ -160,7 +166,7 @@ namespace tut
fail("error() wasn't called"); fail("error() wasn't called");
} }
} }
LLSD getResult() LLSD getResult()
{ {
return mResult; return mResult;
...@@ -169,7 +175,7 @@ namespace tut ...@@ -169,7 +175,7 @@ namespace tut
{ {
return mHeader; return mHeader;
} }
protected: protected:
bool mSawError; bool mSawError;
U32 mStatus; U32 mStatus;
...@@ -187,18 +193,18 @@ namespace tut ...@@ -187,18 +193,18 @@ namespace tut
: mClient(client) : mClient(client)
{ {
} }
public: public:
static Result* build(HTTPClientTestData& client) static Result* build(HTTPClientTestData& client)
{ {
return new Result(client); return new Result(client);
} }
~Result() ~Result()
{ {
mClient.mResultDeleted = true; mClient.mResultDeleted = true;
} }
virtual void error(U32 status, const std::string& reason) virtual void error(U32 status, const std::string& reason)
{ {
mClient.mSawError = true; mClient.mSawError = true;
...@@ -216,7 +222,7 @@ namespace tut ...@@ -216,7 +222,7 @@ namespace tut
const LLSD& content) const LLSD& content)
{ {
LLHTTPClient::Responder::completed(status, reason, content); LLHTTPClient::Responder::completed(status, reason, content);
mClient.mSawCompleted = true; mClient.mSawCompleted = true;
} }
...@@ -244,12 +250,12 @@ namespace tut ...@@ -244,12 +250,12 @@ namespace tut
mResult.clear(); mResult.clear();
mHeader.clear(); mHeader.clear();
mResultDeleted = false; mResultDeleted = false;
return Result::build(*this); return Result::build(*this);
} }
}; };
typedef test_group<HTTPClientTestData> HTTPClientTestGroup; typedef test_group<HTTPClientTestData> HTTPClientTestGroup;
typedef HTTPClientTestGroup::object HTTPClientTestObject; typedef HTTPClientTestGroup::object HTTPClientTestObject;
HTTPClientTestGroup httpClientTestGroup("http_client"); HTTPClientTestGroup httpClientTestGroup("http_client");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment