From 9538328d5f7cf0f0be5dd77b8e27032e09104fff Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Fri, 24 Jul 2009 15:08:16 -0700 Subject: Adding LLLoginInstance unit test. - Added LLNotificationsInterface class. - Removed LLLoginInstance use of LLNotifications EventAPI --- indra/newview/tests/lllogininstance_test.cpp | 413 +++++++++++++++++++++++++++ 1 file changed, 413 insertions(+) create mode 100644 indra/newview/tests/lllogininstance_test.cpp (limited to 'indra/newview/tests/lllogininstance_test.cpp') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp new file mode 100644 index 0000000000..19cf9cd961 --- /dev/null +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -0,0 +1,413 @@ +/** + * @file lllogininstance_test.cpp + * @brief Test for lllogininstance.cpp. + * + * $LicenseInfo:firstyear=2008&license=internal$ + * Copyright (c) 2008, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "../llviewerprecompiledheaders.h" +// Own header +#include "../lllogininstance.h" +// STL headers +// std headers +// external library headers +// other Linden headers +#include "../test/lltut.h" +#include "llevents.h" + +#if defined(LL_WINDOWS) +#pragma warning(disable: 4355) // using 'this' in base-class ctor initializer expr +#endif + +// Constants +const std::string VIEWERLOGIN_URI("viewerlogin_uri"); +const std::string VIEWERLOGIN_GRIDLABEL("viewerlogin_grid"); + +const std::string APPVIEWER_SERIALNUMBER("appviewer_serialno"); + +// Link seams. + +//----------------------------------------------------------------------------- +static LLEventStream gTestPump("test_pump"); + +#include "lllogin.h" +static std::string gLoginURI; +static LLSD gLoginCreds; +static bool gDisconnectCalled = false; +class LLLogin::Impl +{ +}; +LLLogin::LLLogin() {} +LLLogin::~LLLogin() {} +LLEventPump& LLLogin::getEventPump() { return gTestPump; } +void LLLogin::connect(const std::string& uri, const LLSD& credentials) +{ + gLoginURI = uri; + gLoginCreds = credentials; +} + +void LLLogin::disconnect() +{ + gDisconnectCalled = true; +} + +//----------------------------------------------------------------------------- +#include "../llviewernetwork.h" +unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {'1','2','3','4','5','6'}; /* Flawfinder: ignore */ + +LLViewerLogin::LLViewerLogin() {} +LLViewerLogin::~LLViewerLogin() {} +void LLViewerLogin::getLoginURIs(std::vector& uris) const +{ + uris.push_back(VIEWERLOGIN_URI); +} +std::string LLViewerLogin::getGridLabel() const { return VIEWERLOGIN_GRIDLABEL; } + +//----------------------------------------------------------------------------- +#include "../llviewercontrol.h" +LLControlGroup gSavedSettings("Global"); +LLControlGroup gSavedSkinSettings("Skinning"); +std::string gCurrentVersion = "invalid_version"; + +LLControlGroup::LLControlGroup(const std::string& name) : + LLInstanceTracker(name){} +LLControlGroup::~LLControlGroup() {} +void LLControlGroup::setBOOL(const std::string& name, BOOL val) {} +BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; } +U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only) { return 1; } +void LLControlGroup::setString(const std::string& name, const std::string& val) {} +std::string LLControlGroup::getString(const std::string& name) { return "test_string"; } +BOOL LLControlGroup::declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, BOOL persist) { return TRUE; } +BOOL LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, BOOL persist) { return TRUE; } + +//----------------------------------------------------------------------------- +#include "../llurlsimstring.h" +LLURLSimString LLURLSimString::sInstance; +bool LLURLSimString::parse() { return true; } + +//----------------------------------------------------------------------------- +#include "../llfloatertos.h" +static LLFloaterTOS::ETOSType gTOSType; +static LLFloaterTOS::YesNoCallback gTOSCallback; +LLFloaterTOS* LLFloaterTOS::show(LLFloaterTOS::ETOSType type, + const std::string & message, + const YesNoCallback& callback) +{ + gTOSType = type; + gTOSCallback = callback; + return NULL; +} + +//----------------------------------------------------------------------------- +// LLNotifications +class MockNotifications : public LLNotificationsInterface +{ + boost::function mResponder; + int mAddedCount; + +public: + MockNotifications() : + mResponder(0), + mAddedCount(0) + { + } + + virtual ~MockNotifications() {} + + /* virtual */ LLNotificationPtr add( + const std::string& name, + const LLSD& substitutions, + const LLSD& payload, + LLNotificationFunctorRegistry::ResponseFunctor functor) + { + mResponder = functor; + mAddedCount++; + return LLNotificationPtr((LLNotification*)NULL); + } + + void sendYesResponse() + { + LLSD notification; + LLSD response; + response = 1; + mResponder(notification, response); + } + + void sendNoResponse() + { + LLSD notification; + LLSD response; + response = 2; + mResponder(notification, response); + } + + void sendBogusResponse() + { + LLSD notification; + LLSD response; + response = 666; + mResponder(notification, response); + } + + int addedCount() { return mAddedCount; } +}; + +S32 LLNotification::getSelectedOption(const LLSD& notification, const LLSD& response) +{ + return response.asInteger(); +} + +// misc +std::string xml_escape_string(const std::string& in) +{ + return in; +} + +/***************************************************************************** +* TUT +*****************************************************************************/ +namespace tut +{ + struct lllogininstance_data + { + lllogininstance_data() : logininstance(LLLoginInstance::getInstance()) + { + // Global initialization + gLoginURI.clear(); + gLoginCreds.clear(); + gDisconnectCalled = false; + + // gTOSType = -1; // Set to invalid value. + gTOSCallback = 0; // clear the callback. + + + gSavedSettings.declareBOOL("NoInventoryLibrary", FALSE, "", FALSE); + gSavedSettings.declareBOOL("ConnectAsGod", FALSE, "", FALSE); + gSavedSettings.declareBOOL("UseDebugMenus", FALSE, "", FALSE); + gSavedSettings.declareBOOL("ForceMandatoryUpdate", FALSE, "", FALSE); + gSavedSettings.declareString("ClientSettingsFile", "test_settings.xml", "", FALSE); + gSavedSettings.declareString("VersionChannelName", "test_version_string", "", FALSE); + gSavedSettings.declareString("NextLoginLocation", "", "", FALSE); + gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", FALSE); + + credentials["first"] = "testfirst"; + credentials["last"] = "testlast"; + credentials["passwd"] = "testpass"; + + logininstance->setNotificationsInterface(¬ifications); + } + + LLLoginInstance* logininstance; + LLSD credentials; + MockNotifications notifications; + }; + + typedef test_group lllogininstance_group; + typedef lllogininstance_group::object lllogininstance_object; + lllogininstance_group llsdmgr("lllogininstance"); + + template<> template<> + void lllogininstance_object::test<1>() + { + set_test_name("Test Simple Success And Disconnect"); + + // Test default connect. + logininstance->connect(credentials); + + ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); + + // Dummy success response. + LLSD response; + response["state"] = "online"; + response["progress"] = 1.0; + response["transfer_rate"] = 7; + response["data"] = "test_data"; + + gTestPump.post(response); + + ensure("Success response", logininstance->authSuccess()); + ensure_equals("Test Response Data", logininstance->getResponse().asString(), "test_data"); + + logininstance->disconnect(); + + ensure_equals("Called Login Module Disconnect", gDisconnectCalled, true); + + response.clear(); + response["state"] = "offline"; + response["progress"] = 0.0; + response["transfer_rate"] = 0; + response["data"] = "test_data"; + + gTestPump.post(response); + + ensure("Disconnected", !(logininstance->authSuccess())); + } + + template<> template<> + void lllogininstance_object::test<2>() + { + set_test_name("Test User TOS/Critical message Interaction"); + + const std::string test_uri = "testing-uri"; + + // Test default connect. + logininstance->connect(test_uri, credentials); + + // connect should call LLLogin::connect to init gLoginURI and gLoginCreds. + ensure_equals("Default connect uri", gLoginURI, "testing-uri"); + ensure_equals("Default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false); + ensure_equals("Default for read critical", gLoginCreds["params"]["read_critical"].asBoolean(), false); + + // TOS failure response. + LLSD response; + response["state"] = "offline"; + response["progress"] = 0.0; + response["transfer_rate"] = 7; + response["data"]["reason"] = "tos"; + gTestPump.post(response); + + ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_TOS); + ensure("TOS callback given", gTOSCallback != 0); + gTOSCallback(false); // Call callback denying TOS. + ensure("No TOS, failed auth", logininstance->authFailure()); + + // Start again. + logininstance->connect(test_uri, credentials); + gTestPump.post(response); // Fail for tos again. + gTOSCallback(true); // Accept tos, should reconnect w/ agree_to_tos. + ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true); + ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess()); + + // Fail connection, attempt connect again. + // The new request should have reset agree to tos to default. + response["data"]["reason"] = "key"; // bad creds. + gTestPump.post(response); + ensure("TOS auth failure", logininstance->authFailure()); + + logininstance->connect(test_uri, credentials); + ensure_equals("Reset to default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false); + + // Critical Message failure response. + logininstance->connect(test_uri, credentials); + response["data"]["reason"] = "critical"; // Change response to "critical message" + gTestPump.post(response); + + ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_CRITICAL_MESSAGE); + ensure("TOS callback given", gTOSCallback != 0); + gTOSCallback(true); + ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true); + ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess()); + + // Fail then attempt new connection + response["data"]["reason"] = "key"; // bad creds. + gTestPump.post(response); + ensure("TOS auth failure", logininstance->authFailure()); + logininstance->connect(test_uri, credentials); + ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false); + } + + template<> template<> + void lllogininstance_object::test<3>() + { + set_test_name("Test Mandatory Update User Accepts"); + + // Part 1 - Mandatory Update, with User accepts response. + // Test connect with update needed. + logininstance->connect(credentials); + + ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); + + // Update needed failure response. + LLSD response; + response["state"] = "offline"; + response["progress"] = 0.0; + response["transfer_rate"] = 7; + response["data"]["reason"] = "update"; + gTestPump.post(response); + + ensure_equals("Notification added", notifications.addedCount(), 1); + + notifications.sendYesResponse(); + + ensure("Disconnected", !(logininstance->authSuccess())); + } + + template<> template<> + void lllogininstance_object::test<4>() + { + set_test_name("Test Mandatory Update User Decline"); + + // Test connect with update needed. + logininstance->connect(credentials); + + ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); + + // Update needed failure response. + LLSD response; + response["state"] = "offline"; + response["progress"] = 0.0; + response["transfer_rate"] = 7; + response["data"]["reason"] = "update"; + gTestPump.post(response); + + ensure_equals("Notification added", notifications.addedCount(), 1); + notifications.sendNoResponse(); + + ensure("Disconnected", !(logininstance->authSuccess())); + } + + template<> template<> + void lllogininstance_object::test<6>() + { + set_test_name("Test Optional Update User Accept"); + + // Part 3 - Mandatory Update, with bogus response. + // Test connect with update needed. + logininstance->connect(credentials); + + ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); + + // Update needed failure response. + LLSD response; + response["state"] = "offline"; + response["progress"] = 0.0; + response["transfer_rate"] = 7; + response["data"]["reason"] = "optional"; + gTestPump.post(response); + + ensure_equals("Notification added", notifications.addedCount(), 1); + notifications.sendYesResponse(); + + ensure("Disconnected", !(logininstance->authSuccess())); + } + + template<> template<> + void lllogininstance_object::test<7>() + { + set_test_name("Test Optional Update User Denies"); + + // Part 3 - Mandatory Update, with bogus response. + // Test connect with update needed. + logininstance->connect(credentials); + + ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); + + // Update needed failure response. + LLSD response; + response["state"] = "offline"; + response["progress"] = 0.0; + response["transfer_rate"] = 7; + response["data"]["reason"] = "optional"; + gTestPump.post(response); + + ensure_equals("Notification added", notifications.addedCount(), 1); + notifications.sendNoResponse(); + + // User skips, should be reconnecting. + ensure_equals("reconnect uri", gLoginURI, VIEWERLOGIN_URI); + ensure_equals("skipping optional update", gLoginCreds["params"]["skipoptional"].asBoolean(), true); + } +} -- cgit v1.2.3 From 84ec6b6925afd38522b4436cd223e95a3bc291f4 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Fri, 31 Jul 2009 15:33:06 -0700 Subject: Fixups for changest 486d51877332 merge. Deleting references to things that got deleted in viewer-2.0.0-3 --- indra/newview/tests/lllogininstance_test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/tests/lllogininstance_test.cpp') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 19cf9cd961..5af8acebaf 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -69,7 +69,6 @@ std::string LLViewerLogin::getGridLabel() const { return VIEWERLOGIN_GRIDLABEL; //----------------------------------------------------------------------------- #include "../llviewercontrol.h" LLControlGroup gSavedSettings("Global"); -LLControlGroup gSavedSkinSettings("Skinning"); std::string gCurrentVersion = "invalid_version"; LLControlGroup::LLControlGroup(const std::string& name) : @@ -83,6 +82,9 @@ std::string LLControlGroup::getString(const std::string& name) { return "test_st BOOL LLControlGroup::declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, BOOL persist) { return TRUE; } BOOL LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, BOOL persist) { return TRUE; } +#include "lluicolortable.h" +void LLUIColorTable::saveUserSettings(void)const {} + //----------------------------------------------------------------------------- #include "../llurlsimstring.h" LLURLSimString LLURLSimString::sInstance; -- cgit v1.2.3 From 0bf8a15cc03b48432a5b9e0011a01908ef903960 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Wed, 5 Aug 2009 18:39:02 -0700 Subject: Fixups after the latest merge with viewer-2.0.0-3. Updated LLLoginInstance to use the new LLFloaterReg way of getting hold of floaters. --- indra/newview/tests/lllogininstance_test.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'indra/newview/tests/lllogininstance_test.cpp') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 5af8acebaf..d3080d6e4a 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -91,15 +91,23 @@ LLURLSimString LLURLSimString::sInstance; bool LLURLSimString::parse() { return true; } //----------------------------------------------------------------------------- +#include "llfloaterreg.h" #include "../llfloatertos.h" -static LLFloaterTOS::ETOSType gTOSType; +static std::string gTOSType; static LLFloaterTOS::YesNoCallback gTOSCallback; -LLFloaterTOS* LLFloaterTOS::show(LLFloaterTOS::ETOSType type, - const std::string & message, - const YesNoCallback& callback) + +void LLFloaterTOS::setTOSCallback(YesNoCallback const & callback) { - gTOSType = type; gTOSCallback = callback; +} + +//static +LLFloater* LLFloaterReg::showInstance(const std::string & name, + const LLSD & key, + BOOL focus) +{ + gTOSType = name; + gTOSCallback = LLFloaterTOS::YesNoCallback(); return NULL; } @@ -182,7 +190,7 @@ namespace tut gLoginCreds.clear(); gDisconnectCalled = false; - // gTOSType = -1; // Set to invalid value. + gTOSType = ""; // Set to invalid value. gTOSCallback = 0; // clear the callback. @@ -271,7 +279,7 @@ namespace tut response["data"]["reason"] = "tos"; gTestPump.post(response); - ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_TOS); + ensure_equals("TOS Dialog type", gTOSType, "message_tos"); ensure("TOS callback given", gTOSCallback != 0); gTOSCallback(false); // Call callback denying TOS. ensure("No TOS, failed auth", logininstance->authFailure()); @@ -297,7 +305,7 @@ namespace tut response["data"]["reason"] = "critical"; // Change response to "critical message" gTestPump.post(response); - ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_CRITICAL_MESSAGE); + ensure_equals("TOS Dialog type", gTOSType, "message_critical"); ensure("TOS callback given", gTOSCallback != 0); gTOSCallback(true); ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true); -- cgit v1.2.3 From e6c9f944380d3a9b6562cf580e8c43a69c060dfd Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Thu, 6 Aug 2009 18:45:37 -0700 Subject: Backed out changeset bfb246df4655: rolling back LLFloaterTOS post-merge fixups because they didn't work on linux. --- indra/newview/tests/lllogininstance_test.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'indra/newview/tests/lllogininstance_test.cpp') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index d3080d6e4a..5af8acebaf 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -91,23 +91,15 @@ LLURLSimString LLURLSimString::sInstance; bool LLURLSimString::parse() { return true; } //----------------------------------------------------------------------------- -#include "llfloaterreg.h" #include "../llfloatertos.h" -static std::string gTOSType; +static LLFloaterTOS::ETOSType gTOSType; static LLFloaterTOS::YesNoCallback gTOSCallback; - -void LLFloaterTOS::setTOSCallback(YesNoCallback const & callback) +LLFloaterTOS* LLFloaterTOS::show(LLFloaterTOS::ETOSType type, + const std::string & message, + const YesNoCallback& callback) { + gTOSType = type; gTOSCallback = callback; -} - -//static -LLFloater* LLFloaterReg::showInstance(const std::string & name, - const LLSD & key, - BOOL focus) -{ - gTOSType = name; - gTOSCallback = LLFloaterTOS::YesNoCallback(); return NULL; } @@ -190,7 +182,7 @@ namespace tut gLoginCreds.clear(); gDisconnectCalled = false; - gTOSType = ""; // Set to invalid value. + // gTOSType = -1; // Set to invalid value. gTOSCallback = 0; // clear the callback. @@ -279,7 +271,7 @@ namespace tut response["data"]["reason"] = "tos"; gTestPump.post(response); - ensure_equals("TOS Dialog type", gTOSType, "message_tos"); + ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_TOS); ensure("TOS callback given", gTOSCallback != 0); gTOSCallback(false); // Call callback denying TOS. ensure("No TOS, failed auth", logininstance->authFailure()); @@ -305,7 +297,7 @@ namespace tut response["data"]["reason"] = "critical"; // Change response to "critical message" gTestPump.post(response); - ensure_equals("TOS Dialog type", gTOSType, "message_critical"); + ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_CRITICAL_MESSAGE); ensure("TOS callback given", gTOSCallback != 0); gTOSCallback(true); ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true); -- cgit v1.2.3 From 8f4811f3fd7f252a5f5bc50ed11fecd8e42f3e68 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Tue, 11 Aug 2009 12:09:18 -0400 Subject: Better solution for fixing up the LLFloaterTOS callback after the last viewer-2.0.0-3 merge. LLFloaterTOS and LLLoginInstance now communicate through an event pump "lllogininstance_tos_callback". reviewed by Mani. --- indra/newview/tests/lllogininstance_test.cpp | 33 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'indra/newview/tests/lllogininstance_test.cpp') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 5af8acebaf..a84e796159 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -92,14 +92,15 @@ bool LLURLSimString::parse() { return true; } //----------------------------------------------------------------------------- #include "../llfloatertos.h" -static LLFloaterTOS::ETOSType gTOSType; -static LLFloaterTOS::YesNoCallback gTOSCallback; -LLFloaterTOS* LLFloaterTOS::show(LLFloaterTOS::ETOSType type, - const std::string & message, - const YesNoCallback& callback) +#include "llfloaterreg.h" +static std::string gTOSType; +static LLEventPump * gTOSReplyPump = NULL; + +//static +LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, BOOL focus) { - gTOSType = type; - gTOSCallback = callback; + gTOSType = name; + gTOSReplyPump = &LLEventPumps::instance().obtain(key["reply_pump"]); return NULL; } @@ -182,8 +183,8 @@ namespace tut gLoginCreds.clear(); gDisconnectCalled = false; - // gTOSType = -1; // Set to invalid value. - gTOSCallback = 0; // clear the callback. + gTOSType = ""; // Set to invalid value. + gTOSReplyPump = 0; // clear the callback. gSavedSettings.declareBOOL("NoInventoryLibrary", FALSE, "", FALSE); @@ -271,15 +272,15 @@ namespace tut response["data"]["reason"] = "tos"; gTestPump.post(response); - ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_TOS); - ensure("TOS callback given", gTOSCallback != 0); - gTOSCallback(false); // Call callback denying TOS. + ensure_equals("TOS Dialog type", gTOSType, "message_tos"); + ensure("TOS callback given", gTOSReplyPump != 0); + gTOSReplyPump->post(false); // Call callback denying TOS. ensure("No TOS, failed auth", logininstance->authFailure()); // Start again. logininstance->connect(test_uri, credentials); gTestPump.post(response); // Fail for tos again. - gTOSCallback(true); // Accept tos, should reconnect w/ agree_to_tos. + gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos. ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true); ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess()); @@ -297,9 +298,9 @@ namespace tut response["data"]["reason"] = "critical"; // Change response to "critical message" gTestPump.post(response); - ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_CRITICAL_MESSAGE); - ensure("TOS callback given", gTOSCallback != 0); - gTOSCallback(true); + ensure_equals("TOS Dialog type", gTOSType, "message_critical"); + ensure("TOS callback given", gTOSReplyPump != 0); + gTOSReplyPump->post(true); ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true); ensure("Incomplete login status", !logininstance->authFailure() && !logininstance->authSuccess()); -- cgit v1.2.3 From 08f3ea28f5681bbbd755947ec09970c11410bd0a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 11 Sep 2009 22:12:34 -0400 Subject: QAR-1619: Remove unneeded llfloatertos.h #includes. Neither lllogininstance.cpp nor lllogininstance_test.cpp need llfloatertos.h any more, since LLLoginInstance talks to LLFloaterTOS only via LLFloaterReg and LLEventPumps. However, both sources depended on llfloatertos.h dragging in llnotifications.h, so include that explicitly instead of llfloatertos.h. --- indra/newview/tests/lllogininstance_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/tests/lllogininstance_test.cpp') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index a84e796159..75db76df27 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -91,7 +91,7 @@ LLURLSimString LLURLSimString::sInstance; bool LLURLSimString::parse() { return true; } //----------------------------------------------------------------------------- -#include "../llfloatertos.h" +#include "llnotifications.h" #include "llfloaterreg.h" static std::string gTOSType; static LLEventPump * gTOSReplyPump = NULL; -- cgit v1.2.3 From e3a4e3dc10a96b0822674cea262f41774e55a660 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 9 Oct 2009 19:42:59 -0400 Subject: DEV-40930: Added ["change"] key to login-module status events. Changed existing event calls to use state as "offline" or "online", with "change" indicating the reason for this status event. Changed disconnect() to send state "offline", change "disconnect" -- instead of replaying last auth failure. Changed unit tests accordingly. Changed LLLoginInstance::handleLoginEvent() to use LLEventDispatcher to route calls to handleLoginFailure() et al. Added LLEventDispatcher::get() to allow retrieving Callable by name and testing for empty(). --- indra/newview/tests/lllogininstance_test.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/tests/lllogininstance_test.cpp') diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 75db76df27..009be35f64 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -225,6 +225,7 @@ namespace tut // Dummy success response. LLSD response; response["state"] = "online"; + response["change"] = "connect"; response["progress"] = 1.0; response["transfer_rate"] = 7; response["data"] = "test_data"; @@ -240,6 +241,7 @@ namespace tut response.clear(); response["state"] = "offline"; + response["change"] = "disconnect"; response["progress"] = 0.0; response["transfer_rate"] = 0; response["data"] = "test_data"; @@ -267,6 +269,7 @@ namespace tut // TOS failure response. LLSD response; response["state"] = "offline"; + response["change"] = "fail.login"; response["progress"] = 0.0; response["transfer_rate"] = 7; response["data"]["reason"] = "tos"; @@ -326,6 +329,7 @@ namespace tut // Update needed failure response. LLSD response; response["state"] = "offline"; + response["change"] = "fail.login"; response["progress"] = 0.0; response["transfer_rate"] = 7; response["data"]["reason"] = "update"; @@ -351,6 +355,7 @@ namespace tut // Update needed failure response. LLSD response; response["state"] = "offline"; + response["change"] = "fail.login"; response["progress"] = 0.0; response["transfer_rate"] = 7; response["data"]["reason"] = "update"; @@ -376,6 +381,7 @@ namespace tut // Update needed failure response. LLSD response; response["state"] = "offline"; + response["change"] = "fail.login"; response["progress"] = 0.0; response["transfer_rate"] = 7; response["data"]["reason"] = "optional"; @@ -401,6 +407,7 @@ namespace tut // Update needed failure response. LLSD response; response["state"] = "offline"; + response["change"] = "fail.login"; response["progress"] = 0.0; response["transfer_rate"] = 7; response["data"]["reason"] = "optional"; -- cgit v1.2.3