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

SL-793: Fix lllogin_test.cpp for new LLCoros implementation.

Delete the test for SRV timeout: lllogin no longer issues an SRV query. That
test only confuses the test program without exercising any useful paths in
production code.

As with other tests dating from the previous LLCoros implementation, we need a
few llcoro::suspend() calls sprinkled in so that a fiber marked ready -- by
fulfilling the future for which it is waiting -- gets a chance to run.

Clear LLEventPumps between test functions.
parent 939d3505
No related branches found
No related tags found
No related merge requests found
......@@ -241,9 +241,7 @@ void LLCoros::winlevel(const callable_t& callable)
#endif
// Top-level wrapper around caller's coroutine callable. This function accepts
// the coroutine library's implicit coro::self& parameter and saves it, but
// does not pass it down to the caller's callable.
// Top-level wrapper around caller's coroutine callable.
void LLCoros::toplevel(const std::string& name, const callable_t& callable)
{
CoroData* corodata = new CoroData(name);
......
......@@ -164,11 +164,15 @@ namespace tut
{
struct llviewerlogin_data
{
llviewerlogin_data() :
llviewerlogin_data() :
pumps(LLEventPumps::instance())
{}
LLEventPumps& pumps;
};
{}
~llviewerlogin_data()
{
pumps.clear();
}
LLEventPumps& pumps;
};
typedef test_group<llviewerlogin_data> llviewerlogin_group;
typedef llviewerlogin_group::object llviewerlogin_object;
......@@ -241,6 +245,7 @@ namespace tut
data["responses"]["login"] = "false";
dummyXMLRPC.setResponse(data);
dummyXMLRPC.sendReply();
llcoro::suspend();
ensure_equals("Failed to offline", listener.lastEvent()["state"].asString(), "offline");
}
......@@ -280,41 +285,8 @@ namespace tut
data["transfer_rate"] = 0;
dummyXMLRPC.setResponse(data);
dummyXMLRPC.sendReply();
ensure_equals("Failed to offline", listener.lastEvent()["state"].asString(), "offline");
}
template<> template<>
void llviewerlogin_object::test<4>()
{
DEBUG;
// Test SRV request timeout.
set_test_name("LLLogin SRV timeout testing");
// Testing normal login procedure.
LLLogin login;
LoginListener listener("test_ear");
listener.listenTo(login.getEventPump());
LLSD credentials;
credentials["first"] = "these";
credentials["last"] = "don't";
credentials["passwd"] = "matter";
credentials["cfg_srv_timeout"] = 0.0f;
login.connect("login.bar.com", credentials);
llcoro::suspend();
// Get the mainloop eventpump, which needs a pinging in order to drive the
// SRV timeout.
LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop"));
LLSD frame_event;
mainloop.post(frame_event);
ensure_equals("Auth state", listener.lastEvent()["change"].asString(), "authenticating");
ensure_equals("Attempt", listener.lastEvent()["data"]["attempt"].asInteger(), 1);
ensure_equals("URI", listener.lastEvent()["data"]["request"]["uri"].asString(), "login.bar.com");
ensure_equals("Failed to offline", listener.lastEvent()["state"].asString(), "offline");
}
}
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