summaryrefslogtreecommitdiff
path: root/indra/newview/tests/lllogininstance_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/tests/lllogininstance_test.cpp')
-rw-r--r--indra/newview/tests/lllogininstance_test.cpp116
1 files changed, 93 insertions, 23 deletions
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index 7b28a3b72c..f4d9cc99cc 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -10,7 +10,10 @@
// Precompiled header
#include "../llviewerprecompiledheaders.h"
// Own header
+#include "../llsecapi.h"
+#include "../llviewernetwork.h"
#include "../lllogininstance.h"
+
// STL headers
// std headers
// external library headers
@@ -33,7 +36,12 @@ const std::string APPVIEWER_SERIALNUMBER("appviewer_serialno");
//-----------------------------------------------------------------------------
static LLEventStream gTestPump("test_pump");
+#include "../llslurl.h"
+#include "../llstartup.h"
+LLSLURL LLStartUp::sStartSLURL;
+
#include "lllogin.h"
+
static std::string gLoginURI;
static LLSD gLoginCreds;
static bool gDisconnectCalled = false;
@@ -54,17 +62,69 @@ void LLLogin::disconnect()
gDisconnectCalled = true;
}
+LLSD LLCredential::getLoginParams()
+{
+ LLSD result = LLSD::emptyMap();
+
+ // legacy credential
+ result["passwd"] = "$1$testpasssd";
+ result["first"] = "myfirst";
+ result["last"] ="mylast";
+ return result;
+}
+
//-----------------------------------------------------------------------------
#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<std::string>& uris) const
+LLGridManager::~LLGridManager()
+{
+}
+
+void LLGridManager::addGrid(LLSD& grid_data)
+{
+}
+LLGridManager::LLGridManager()
+{
+}
+
+void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
{
uris.push_back(VIEWERLOGIN_URI);
}
-std::string LLViewerLogin::getGridLabel() const { return VIEWERLOGIN_GRIDLABEL; }
+
+void LLGridManager::addSystemGrid(const std::string& label,
+ const std::string& name,
+ const std::string& login,
+ const std::string& helper,
+ const std::string& login_page,
+ const std::string& login_id)
+{
+}
+std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
+{
+ std::map<std::string, std::string> result;
+ return result;
+}
+
+void LLGridManager::setGridChoice(const std::string& grid_name)
+{
+}
+
+bool LLGridManager::isInProductionGrid()
+{
+ return false;
+}
+
+void LLGridManager::saveFavorites()
+{}
+std::string LLGridManager::getSLURLBase(const std::string& grid_name)
+{
+ return "myslurl";
+}
+std::string LLGridManager::getAppSLURLBase(const std::string& grid_name)
+{
+ return "myappslurl";
+}
//-----------------------------------------------------------------------------
#include "../llviewercontrol.h"
@@ -86,10 +146,6 @@ BOOL LLControlGroup::declareString(const std::string& name, const std::string &i
#include "lluicolortable.h"
void LLUIColorTable::saveUserSettings(void)const {}
-//-----------------------------------------------------------------------------
-#include "../llurlsimstring.h"
-LLURLSimString LLURLSimString::sInstance;
-bool LLURLSimString::parse() { return true; }
//-----------------------------------------------------------------------------
#include "llnotifications.h"
@@ -197,15 +253,29 @@ namespace tut
gSavedSettings.declareString("NextLoginLocation", "", "", FALSE);
gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", FALSE);
- credentials["first"] = "testfirst";
- credentials["last"] = "testlast";
- credentials["passwd"] = "testpass";
+ LLSD authenticator = LLSD::emptyMap();
+ LLSD identifier = LLSD::emptyMap();
+ identifier["type"] = "agent";
+ identifier["first_name"] = "testfirst";
+ identifier["last_name"] = "testlast";
+ authenticator["passwd"] = "testpass";
+ agentCredential = new LLCredential();
+ agentCredential->setCredentialData(identifier, authenticator);
+
+ authenticator = LLSD::emptyMap();
+ identifier = LLSD::emptyMap();
+ identifier["type"] = "account";
+ identifier["username"] = "testuser";
+ authenticator["secret"] = "testsecret";
+ accountCredential = new LLCredential();
+ accountCredential->setCredentialData(identifier, authenticator);
logininstance->setNotificationsInterface(&notifications);
}
LLLoginInstance* logininstance;
- LLSD credentials;
+ LLPointer<LLCredential> agentCredential;
+ LLPointer<LLCredential> accountCredential;
MockNotifications notifications;
};
@@ -219,7 +289,7 @@ namespace tut
set_test_name("Test Simple Success And Disconnect");
// Test default connect.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
@@ -260,7 +330,7 @@ namespace tut
const std::string test_uri = "testing-uri";
// Test default connect.
- logininstance->connect(test_uri, credentials);
+ logininstance->connect(test_uri, agentCredential);
// connect should call LLLogin::connect to init gLoginURI and gLoginCreds.
ensure_equals("Default connect uri", gLoginURI, "testing-uri");
@@ -282,7 +352,7 @@ namespace tut
ensure("No TOS, failed auth", logininstance->authFailure());
// Start again.
- logininstance->connect(test_uri, credentials);
+ logininstance->connect(test_uri, agentCredential);
gTestPump.post(response); // Fail for tos again.
gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos.
ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true);
@@ -294,11 +364,11 @@ namespace tut
gTestPump.post(response);
ensure("TOS auth failure", logininstance->authFailure());
- logininstance->connect(test_uri, credentials);
+ logininstance->connect(test_uri, agentCredential);
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);
+ logininstance->connect(test_uri, agentCredential);
response["data"]["reason"] = "critical"; // Change response to "critical message"
gTestPump.post(response);
@@ -312,7 +382,7 @@ namespace tut
response["data"]["reason"] = "key"; // bad creds.
gTestPump.post(response);
ensure("TOS auth failure", logininstance->authFailure());
- logininstance->connect(test_uri, credentials);
+ logininstance->connect(test_uri, agentCredential);
ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false);
}
@@ -323,7 +393,7 @@ namespace tut
// Part 1 - Mandatory Update, with User accepts response.
// Test connect with update needed.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
@@ -349,7 +419,7 @@ namespace tut
set_test_name("Test Mandatory Update User Decline");
// Test connect with update needed.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
@@ -375,7 +445,7 @@ namespace tut
// Part 3 - Mandatory Update, with bogus response.
// Test connect with update needed.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);
@@ -401,7 +471,7 @@ namespace tut
// Part 3 - Mandatory Update, with bogus response.
// Test connect with update needed.
- logininstance->connect(credentials);
+ logininstance->connect(agentCredential);
ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI);