diff options
author | Roxie Linden <roxie@lindenlab.com> | 2010-02-01 15:10:19 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2010-02-01 15:10:19 -0800 |
commit | fe71dd340ab396b93bde45df438041af5d85fd47 (patch) | |
tree | b07b92b80e5a8f113252ea0b650684567557c851 /indra/newview/tests/lllogininstance_test.cpp | |
parent | 1a9d19d95527d717b89d4ebf45af81824fcbdf44 (diff) |
Merge giab-viewer-trunk 2497, general merge of more
secapi stuff as well as certificate handling stuff.
Grid manager as well
Diffstat (limited to 'indra/newview/tests/lllogininstance_test.cpp')
-rw-r--r-- | indra/newview/tests/lllogininstance_test.cpp | 107 |
1 files changed, 88 insertions, 19 deletions
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 7b28a3b72c..9222882f5f 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 @@ -54,17 +57,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" @@ -197,15 +252,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(¬ifications); } LLLoginInstance* logininstance; - LLSD credentials; + LLPointer<LLCredential> agentCredential; + LLPointer<LLCredential> accountCredential; MockNotifications notifications; }; @@ -219,7 +288,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 +329,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 +351,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 +363,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 +381,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 +392,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 +418,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 +444,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 +470,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); |