diff options
Diffstat (limited to 'indra/newview/tests')
34 files changed, 580 insertions, 613 deletions
diff --git a/indra/newview/tests/gpus_results.txt b/indra/newview/tests/gpus_results.txt index 68e2e688cb..68e2e688cb 100644..100755 --- a/indra/newview/tests/gpus_results.txt +++ b/indra/newview/tests/gpus_results.txt diff --git a/indra/newview/tests/gpus_seen.txt b/indra/newview/tests/gpus_seen.txt index 570f92a9b0..570f92a9b0 100644..100755 --- a/indra/newview/tests/gpus_seen.txt +++ b/indra/newview/tests/gpus_seen.txt diff --git a/indra/newview/tests/llagentaccess_test.cpp b/indra/newview/tests/llagentaccess_test.cpp index c970d79975..45ce1ba62f 100644..100755 --- a/indra/newview/tests/llagentaccess_test.cpp +++ b/indra/newview/tests/llagentaccess_test.cpp @@ -40,7 +40,7 @@ static U32 test_preferred_maturity = SIM_ACCESS_PG; LLControlGroup::LLControlGroup(const std::string& name) - : LLInstanceTracker<LLControlGroup, std::string>(name) +: LLInstanceTracker<LLControlGroup, std::string>(name) { } @@ -49,10 +49,10 @@ LLControlGroup::~LLControlGroup() } // Implementation of just the LLControlGroup methods we requre -BOOL LLControlGroup::declareU32(const std::string& name, U32 initial_val, const std::string& comment, BOOL persist) +LLControlVariable* LLControlGroup::declareU32(const std::string& name, U32 initial_val, const std::string& comment, LLControlVariable::ePersist persist) { test_preferred_maturity = initial_val; - return true; + return NULL; } void LLControlGroup::setU32(const std::string& name, U32 val) @@ -80,72 +80,76 @@ namespace tut void agentaccess_object_t::test<1>() { LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", FALSE); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); LLAgentAccess aa(cgr); cgr.setU32("PreferredMaturity", SIM_ACCESS_PG); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 prefersPG", aa.prefersPG()); ensure("1 prefersMature", !aa.prefersMature()); ensure("1 prefersAdult", !aa.prefersAdult()); +#endif // HACKED_GODLIKE_VIEWER cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE); +#ifndef HACKED_GODLIKE_VIEWER ensure("2 prefersPG", !aa.prefersPG()); ensure("2 prefersMature", aa.prefersMature()); ensure("2 prefersAdult", !aa.prefersAdult()); +#endif // HACKED_GODLIKE_VIEWER cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); +#ifndef HACKED_GODLIKE_VIEWER ensure("3 prefersPG", !aa.prefersPG()); ensure("3 prefersMature", aa.prefersMature()); ensure("3 prefersAdult", aa.prefersAdult()); +#endif // HACKED_GODLIKE_VIEWER } template<> template<> void agentaccess_object_t::test<2>() { LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", FALSE); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); LLAgentAccess aa(cgr); // make sure default is PG +#ifndef HACKED_GODLIKE_VIEWER ensure("1 isTeen", aa.isTeen()); ensure("1 isMature", !aa.isMature()); ensure("1 isAdult", !aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER - // this is kinda bad -- setting this forces maturity to MATURE but !teen != Mature anymore - aa.setTeen(false); - ensure("2 isTeen", !aa.isTeen()); - ensure("2 isMature", aa.isMature()); - ensure("2 isAdult", !aa.isAdult()); - - // have to flip it back and make sure it still works - aa.setTeen(true); - ensure("3 isTeen", aa.isTeen()); - ensure("3 isMature", !aa.isMature()); - ensure("3 isAdult", !aa.isAdult()); - // check the conversion routine +#ifndef HACKED_GODLIKE_VIEWER ensure_equals("1 conversion", SIM_ACCESS_PG, aa.convertTextToMaturity('P')); ensure_equals("2 conversion", SIM_ACCESS_MATURE, aa.convertTextToMaturity('M')); ensure_equals("3 conversion", SIM_ACCESS_ADULT, aa.convertTextToMaturity('A')); ensure_equals("4 conversion", SIM_ACCESS_MIN, aa.convertTextToMaturity('Q')); +#endif // HACKED_GODLIKE_VIEWER // now try the other method of setting it - PG aa.setMaturity('P'); - ensure("4 isTeen", aa.isTeen()); - ensure("4 isMature", !aa.isMature()); - ensure("4 isAdult", !aa.isAdult()); + ensure("2 isTeen", aa.isTeen()); +#ifndef HACKED_GODLIKE_VIEWER + ensure("2 isMature", !aa.isMature()); + ensure("2 isAdult", !aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER // Mature aa.setMaturity('M'); - ensure("5 isTeen", !aa.isTeen()); - ensure("5 isMature", aa.isMature()); - ensure("5 isAdult", !aa.isAdult()); +#ifndef HACKED_GODLIKE_VIEWER + ensure("3 isTeen", !aa.isTeen()); + ensure("3 isMature", aa.isMature()); + ensure("3 isAdult", !aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER // Adult aa.setMaturity('A'); - ensure("6 isTeen", !aa.isTeen()); - ensure("6 isMature", aa.isMature()); - ensure("6 isAdult", aa.isAdult()); +#ifndef HACKED_GODLIKE_VIEWER + ensure("4 isTeen", !aa.isTeen()); + ensure("4 isMature", aa.isMature()); + ensure("4 isAdult", aa.isAdult()); +#endif // HACKED_GODLIKE_VIEWER } @@ -153,82 +157,114 @@ namespace tut void agentaccess_object_t::test<3>() { LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", FALSE); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); LLAgentAccess aa(cgr); +#ifndef HACKED_GODLIKE_VIEWER ensure("starts normal", !aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_NOT); +#ifndef HACKED_GODLIKE_VIEWER ensure("stays normal", !aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_FULL); +#ifndef HACKED_GODLIKE_VIEWER ensure("sets full", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_NOT); +#ifndef HACKED_GODLIKE_VIEWER ensure("resets normal", !aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setAdminOverride(true); +#ifndef HACKED_GODLIKE_VIEWER ensure("admin true", aa.getAdminOverride()); ensure("overrides 1", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_FULL); +#ifndef HACKED_GODLIKE_VIEWER ensure("overrides 2", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER aa.setAdminOverride(false); +#ifndef HACKED_GODLIKE_VIEWER ensure("admin false", !aa.getAdminOverride()); ensure("overrides 3", aa.isGodlike()); +#endif // HACKED_GODLIKE_VIEWER } template<> template<> void agentaccess_object_t::test<4>() { LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", FALSE); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); LLAgentAccess aa(cgr); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 pg to start", aa.wantsPGOnly()); ensure("2 pg to start", !aa.canAccessMature()); ensure("3 pg to start", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_FULL); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 full god", !aa.wantsPGOnly()); ensure("2 full god", aa.canAccessMature()); ensure("3 full god", aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER aa.setGodLevel(GOD_NOT); aa.setAdminOverride(true); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 admin mode", !aa.wantsPGOnly()); ensure("2 admin mode", aa.canAccessMature()); ensure("3 admin mode", aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER aa.setAdminOverride(false); aa.setMaturity('M'); // preferred is still pg by default +#ifndef HACKED_GODLIKE_VIEWER ensure("1 mature pref pg", aa.wantsPGOnly()); ensure("2 mature pref pg", !aa.canAccessMature()); ensure("3 mature pref pg", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER cgr.setU32("PreferredMaturity", SIM_ACCESS_MATURE); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 mature", !aa.wantsPGOnly()); ensure("2 mature", aa.canAccessMature()); ensure("3 mature", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER cgr.setU32("PreferredMaturity", SIM_ACCESS_PG); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 mature pref pg", aa.wantsPGOnly()); ensure("2 mature pref pg", !aa.canAccessMature()); ensure("3 mature pref pg", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER aa.setMaturity('A'); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 adult pref pg", aa.wantsPGOnly()); ensure("2 adult pref pg", !aa.canAccessMature()); ensure("3 adult pref pg", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 adult", !aa.wantsPGOnly()); ensure("2 adult", aa.canAccessMature()); ensure("3 adult", aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER // make sure that even if pref is high, if access is low we block access // this shouldn't occur in real life but we want to be safe cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); aa.setMaturity('P'); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 pref adult, actual pg", aa.wantsPGOnly()); ensure("2 pref adult, actual pg", !aa.canAccessMature()); ensure("3 pref adult, actual pg", !aa.canAccessAdult()); +#endif // HACKED_GODLIKE_VIEWER } @@ -236,27 +272,19 @@ namespace tut void agentaccess_object_t::test<5>() { LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", FALSE); - LLAgentAccess aa(cgr); - - ensure("1 transition starts false", !aa.isInTransition()); - aa.setTransition(); - ensure("2 transition now true", aa.isInTransition()); - } - - template<> template<> - void agentaccess_object_t::test<6>() - { - LLControlGroup cgr("test"); - cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", FALSE); + cgr.declareU32("PreferredMaturity", SIM_ACCESS_PG, "declared_for_test", LLControlVariable::PERSIST_NO); LLAgentAccess aa(cgr); cgr.setU32("PreferredMaturity", SIM_ACCESS_ADULT); aa.setMaturity('M'); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 preferred maturity pegged to M when maturity is M", cgr.getU32("PreferredMaturity") == SIM_ACCESS_MATURE); +#endif // HACKED_GODLIKE_VIEWER aa.setMaturity('P'); +#ifndef HACKED_GODLIKE_VIEWER ensure("1 preferred maturity pegged to P when maturity is P", cgr.getU32("PreferredMaturity") == SIM_ACCESS_PG); +#endif // HACKED_GODLIKE_VIEWER } } diff --git a/indra/newview/tests/llcapabilitylistener_test.cpp b/indra/newview/tests/llcapabilitylistener_test.cpp index e1cbd28f92..e1cbd28f92 100644..100755 --- a/indra/newview/tests/llcapabilitylistener_test.cpp +++ b/indra/newview/tests/llcapabilitylistener_test.cpp diff --git a/indra/newview/tests/lldateutil_test.cpp b/indra/newview/tests/lldateutil_test.cpp index 47353962e1..47353962e1 100644..100755 --- a/indra/newview/tests/lldateutil_test.cpp +++ b/indra/newview/tests/lldateutil_test.cpp diff --git a/indra/newview/tests/lldir_stub.cpp b/indra/newview/tests/lldir_stub.cpp index 18cf4e7419..2bc6772d86 100644..100755 --- a/indra/newview/tests/lldir_stub.cpp +++ b/indra/newview/tests/lldir_stub.cpp @@ -32,7 +32,7 @@ BOOL LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask void LLDir::setChatLogsDir(const std::string &path) {} void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string &last) {} void LLDir::setLindenUserDir(const std::string &first, const std::string &last) {} -void LLDir::setSkinFolder(const std::string &skin_folder) {} +void LLDir::setSkinFolder(const std::string &skin_folder, const std::string& language) {} bool LLDir::setCacheDir(const std::string &path) { return true; } void LLDir::dumpCurrentDirectories() {} @@ -48,7 +48,7 @@ public: /*virtual*/ U32 countFilesInDir(const std::string &dirname, const std::string &mask) { return 42; } /*virtual*/ BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) { fname = fname + "_NEXT"; return false; } /*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { fname = "RANDOM_FILE"; } - /*virtual*/ BOOL fileExists(const std::string &filename) const { return false; } + /*virtual*/ bool fileExists(const std::string &filename) const { return false; } }; LLDir_stub gDirUtil; diff --git a/indra/newview/tests/llglslshader_stub.cpp b/indra/newview/tests/llglslshader_stub.cpp index 8947a632c8..8947a632c8 100644..100755 --- a/indra/newview/tests/llglslshader_stub.cpp +++ b/indra/newview/tests/llglslshader_stub.cpp diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 9e321db889..adeb848e03 100644..100755 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -50,7 +50,7 @@ const std::string VIEWERLOGIN_GRIDLABEL("viewerlogin_grid"); const std::string APPVIEWER_SERIALNUMBER("appviewer_serialno"); const std::string VIEWERLOGIN_CHANNEL("invalid_channel"); -const std::string VIEWERLOGIN_VERSION_CHANNEL("invalid_version"); +const std::string VIEWERLOGIN_VERSION("invalid_version"); // Link seams. @@ -60,6 +60,7 @@ static LLEventStream gTestPump("test_pump"); #include "../llslurl.h" #include "../llstartup.h" LLSLURL LLStartUp::sStartSLURL; +LLSLURL& LLStartUp::getStartSLURL() { return sStartSLURL; } #include "lllogin.h" @@ -72,7 +73,7 @@ void LLViewerWindow::setShowProgress(BOOL show) {} LLProgressView * LLViewerWindow::getProgressView(void) const { return 0; } LLViewerWindow* gViewerWindow; - + class LLLogin::Impl { }; @@ -114,8 +115,9 @@ LLGridManager::~LLGridManager() { } -void LLGridManager::addGrid(LLSD& grid_data) +bool LLGridManager::addGrid(LLSD& grid_data) { + return true; } LLGridManager::LLGridManager() : @@ -133,10 +135,11 @@ void LLGridManager::addSystemGrid(const std::string& label, const std::string& login, const std::string& helper, const std::string& login_page, + const std::string& update_url_base, const std::string& login_id) { } -std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only) +std::map<std::string, std::string> LLGridManager::getKnownGrids() { std::map<std::string, std::string> result; return result; @@ -151,8 +154,6 @@ bool LLGridManager::isInProductionGrid() return false; } -void LLGridManager::saveFavorites() -{} std::string LLGridManager::getSLURLBase(const std::string& grid_name) { return "myslurl"; @@ -175,15 +176,15 @@ F32 LLControlGroup::getF32(const std::string& name) { return 0.0f; } 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; } +LLControlVariable* LLControlGroup::declareBOOL(const std::string& name, BOOL initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } +LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string &initial_val, const std::string& comment, LLControlVariable::ePersist persist) { return NULL; } #include "lluicolortable.h" void LLUIColorTable::saveUserSettings(void)const {} //----------------------------------------------------------------------------- #include "../llversioninfo.h" -const std::string &LLVersionInfo::getChannelAndVersion() { return VIEWERLOGIN_VERSION_CHANNEL; } +const std::string &LLVersionInfo::getVersion() { return VIEWERLOGIN_VERSION; } const std::string &LLVersionInfo::getChannel() { return VIEWERLOGIN_CHANNEL; } //----------------------------------------------------------------------------- @@ -208,11 +209,13 @@ std::string const & LLUpdaterService::pumpName(void) return wakka; } bool LLUpdaterService::updateReadyToInstall(void) { return false; } -void LLUpdaterService::initialize(const std::string& protocol_version, - const std::string& url, - const std::string& path, - const std::string& channel, - const std::string& version) {} +void LLUpdaterService::initialize(const std::string& channel, + const std::string& version, + const std::string& platform, + const std::string& platform_version, + const unsigned char uniqueid[MD5HEX_STR_SIZE], + const bool& willing_to_test + ) {} void LLUpdaterService::setCheckPeriod(unsigned int seconds) {} void LLUpdaterService::startChecking(bool install_if_ready) {} @@ -221,6 +224,12 @@ bool LLUpdaterService::isChecking() { return false; } LLUpdaterService::eUpdaterState LLUpdaterService::getState() { return INITIAL; } std::string LLUpdaterService::updatedVersion() { return ""; } +bool llHashedUniqueID(unsigned char* id) +{ + memcpy( id, "66666666666666666666666666666666", MD5HEX_STR_SIZE ); + return true; +} + //----------------------------------------------------------------------------- #include "llnotifications.h" #include "llfloaterreg.h" @@ -334,13 +343,13 @@ namespace tut gTOSReplyPump = 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("NextLoginLocation", "", "", FALSE); - gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", FALSE); + gSavedSettings.declareBOOL("NoInventoryLibrary", FALSE, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("ConnectAsGod", FALSE, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("UseDebugMenus", FALSE, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("ForceMandatoryUpdate", FALSE, "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareString("ClientSettingsFile", "test_settings.xml", "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareString("NextLoginLocation", "", "", LLControlVariable::PERSIST_NO); + gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", LLControlVariable::PERSIST_NO); LLSD authenticator = LLSD::emptyMap(); LLSD identifier = LLSD::emptyMap(); @@ -360,6 +369,7 @@ namespace tut accountCredential->setCredentialData(identifier, authenticator); logininstance->setNotificationsInterface(¬ifications); + logininstance->setPlatformInfo("win", "1.3.5"); } LLLoginInstance* logininstance; diff --git a/indra/newview/tests/llmediadataclient_test.cpp b/indra/newview/tests/llmediadataclient_test.cpp index 0254c5881f..3e55336f2d 100644..100755 --- a/indra/newview/tests/llmediadataclient_test.cpp +++ b/indra/newview/tests/llmediadataclient_test.cpp @@ -39,6 +39,7 @@ #include "../llvovolume.h" #include "../../llprimitive/llmediaentry.cpp" +#include "../../llprimitive/llmaterialid.cpp" #include "../../llprimitive/lltextureentry.cpp" #include "../../llmessage/tests/llcurl_stub.cpp" @@ -126,7 +127,9 @@ void LLHTTPClient::post( result[LLTextureEntry::OBJECT_ID_KEY] = body[LLTextureEntry::OBJECT_ID_KEY]; if ( url == FAKE_OBJECT_MEDIA_CAP_URL_503 ) { - responder->error(HTTP_SERVICE_UNAVAILABLE, "fake reason"); + LLSD content; + content["reason"] = "fake reason"; + responder->errorWithContent(HTTP_SERVICE_UNAVAILABLE, "fake reason", content); return; } else if (url == FAKE_OBJECT_MEDIA_NAVIGATE_CAP_URL_ERROR) diff --git a/indra/newview/tests/llpipeline_stub.cpp b/indra/newview/tests/llpipeline_stub.cpp index ad112cbf6a..ad112cbf6a 100644..100755 --- a/indra/newview/tests/llpipeline_stub.cpp +++ b/indra/newview/tests/llpipeline_stub.cpp diff --git a/indra/newview/tests/llremoteparcelrequest_test.cpp b/indra/newview/tests/llremoteparcelrequest_test.cpp index ed66066b0a..ed66066b0a 100644..100755 --- a/indra/newview/tests/llremoteparcelrequest_test.cpp +++ b/indra/newview/tests/llremoteparcelrequest_test.cpp diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp index 703603e2db..d7e87ed52e 100644..100755 --- a/indra/newview/tests/llsecapi_test.cpp +++ b/indra/newview/tests/llsecapi_test.cpp @@ -39,10 +39,10 @@ LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) {} LLControlGroup::~LLControlGroup() {} -BOOL LLControlGroup::declareString(const std::string& name, +LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, - BOOL persist) {return TRUE;} + LLControlVariable::ePersist persist) {return NULL;} void LLControlGroup::setString(const std::string& name, const std::string& val){} std::string LLControlGroup::getString(const std::string& name) { diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index 0235400976..2a8dc15346 100644..100755 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -71,10 +71,10 @@ std::string gLastName; LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) {} LLControlGroup::~LLControlGroup() {} -BOOL LLControlGroup::declareString(const std::string& name, +LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, - BOOL persist) {return TRUE;} + LLControlVariable::ePersist persist) {return NULL;} void LLControlGroup::setString(const std::string& name, const std::string& val){} std::string LLControlGroup::getString(const std::string& name) { diff --git a/indra/newview/tests/llsimplestat_test.cpp b/indra/newview/tests/llsimplestat_test.cpp index b556941f4a..b556941f4a 100644..100755 --- a/indra/newview/tests/llsimplestat_test.cpp +++ b/indra/newview/tests/llsimplestat_test.cpp diff --git a/indra/newview/tests/llsky_stub.cpp b/indra/newview/tests/llsky_stub.cpp index 241d740635..241d740635 100644..100755 --- a/indra/newview/tests/llsky_stub.cpp +++ b/indra/newview/tests/llsky_stub.cpp diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index f96f79006a..86229ad636 100644..100755 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -1,4 +1,4 @@ -/** +/** * @file llsecapi_test.cpp * @author Roxie * @date 2009-02-10 @@ -7,21 +7,21 @@ * $LicenseInfo:firstyear=2009&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -31,16 +31,16 @@ #include "../llslurl.h" #include "../../llxml/llcontrol.h" #include "llsdserialize.h" -//---------------------------------------------------------------------------- -// Mock objects for the dependencies of the code we're testing +//---------------------------------------------------------------------------- +// Mock objects for the dependencies of the code we're testing LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) {} LLControlGroup::~LLControlGroup() {} -BOOL LLControlGroup::declareString(const std::string& name, +LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, - BOOL persist) {return TRUE;} + LLControlVariable::ePersist persist) {return NULL;} void LLControlGroup::setString(const std::string& name, const std::string& val){} std::string gCmdLineLoginURI; @@ -80,6 +80,39 @@ LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) } LLControlGroup gSavedSettings("test"); +const char *gSampleGridFile = + "<?xml version=\"1.0\"?>" + "<llsd>" + " <map>" + " <key>foo.bar.com</key>" + " <map>" + " <key>helper_uri</key><string>https://foobar/helpers/</string>" + " <key>label</key><string>Foobar Grid</string>" + " <key>login_page</key><string>foobar/loginpage</string>" + " <key>login_uri</key>" + " <array>" + " <string>foobar/loginuri</string>" + " </array>" + " <key>keyname</key><string>foo.bar.com</string>" + " <key>credential_type</key><string>agent</string>" + " <key>grid_login_id</key><string>FooBar</string>" + " </map>" + " <key>my.grid.com</key>" + " <map>" + " <key>helper_uri</key><string>https://mygrid/helpers/</string>" + " <key>label</key><string>My Grid</string>" + " <key>login_page</key><string>mygrid/loginpage</string>" + " <key>login_uri</key>" + " <array>" + " <string>mygrid/loginuri</string>" + " </array>" + " <key>keyname</key><string>my.grid.com</string>" + " <key>credential_type</key><string>agent</string>" + " <key>grid_login_id</key><string>MyGrid</string>" + " </map>" + " </map>" + "</llsd>" + ; // ------------------------------------------------------------------------------------------- // TUT @@ -90,171 +123,189 @@ namespace tut struct slurlTest { slurlTest() - { + { LLGridManager::getInstance()->initialize(std::string("")); } ~slurlTest() { } }; - + // Tut templating thingamagic: test group, object and test instance typedef test_group<slurlTest> slurlTestFactory; typedef slurlTestFactory::object slurlTestObject; tut::slurlTestFactory tut_test("LLSlurl"); - + // --------------------------------------------------------------------------------------- - // Test functions + // Test functions // --------------------------------------------------------------------------------------- // construction from slurl string template<> template<> void slurlTestObject::test<1>() { + llofstream gridfile("grid_test.xml"); + gridfile << gSampleGridFile; + gridfile.close(); + + LLGridManager::getInstance()->initialize("grid_test.xml"); + LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); - + LLSLURL slurl = LLSLURL(""); ensure_equals("null slurl", (int)slurl.getType(), LLSLURL::LAST_LOCATION); - + slurl = LLSLURL("http://slurl.com/secondlife/myregion"); ensure_equals("slurl.com slurl, region only - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(), + ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(), "http://maps.secondlife.com/secondlife/myregion/128/128/0"); - + slurl = LLSLURL("http://maps.secondlife.com/secondlife/myregion/1/2/3"); ensure_equals("maps.secondlife.com slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("maps.secondlife.com slurl, region + coords", slurl.getSLURLString(), + ensure_equals("maps.secondlife.com slurl, region + coords", slurl.getSLURLString(), "http://maps.secondlife.com/secondlife/myregion/1/2/3"); slurl = LLSLURL("secondlife://myregion"); ensure_equals("secondlife: slurl, region only - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(), + ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(), "http://maps.secondlife.com/secondlife/myregion/128/128/0"); - + slurl = LLSLURL("secondlife://myregion/1/2/3"); ensure_equals("secondlife: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(), + ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(), "http://maps.secondlife.com/secondlife/myregion/1/2/3"); - + slurl = LLSLURL("/myregion"); ensure_equals("/region slurl, region- type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("/region slurl, region ", slurl.getSLURLString(), + ensure_equals("/region slurl, region ", slurl.getSLURLString(), "http://maps.secondlife.com/secondlife/myregion/128/128/0"); - + slurl = LLSLURL("/myregion/1/2/3"); ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/myregion/1/2/3"); - + ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/myregion/1/2/3"); + slurl = LLSLURL("my region/1/2/3"); ensure_equals(" slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" slurl, region + coords", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/my%20region/1/2/3"); - - LLGridManager::getInstance()->setGridChoice("my.grid.com"); + ensure_equals(" slurl, region + coords", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/my%20region/1/2/3"); + + LLGridManager::getInstance()->setGridChoice("my.grid.com"); slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3"); ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), - "https://my.grid.com/region/my%20region/1/2/3"); - + ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), + "https://my.grid.com/region/my%20region/1/2/3"); + slurl = LLSLURL("https://my.grid.com/region/my region"); ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), + ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), "https://my.grid.com/region/my%20region/128/128/0"); - - LLGridManager::getInstance()->setGridChoice("foo.bar.com"); + + LLGridManager::getInstance()->setGridChoice("foo.bar.com"); slurl = LLSLURL("/myregion/1/2/3"); ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), - "https://foo.bar.com/region/myregion/1/2/3"); - + ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), + "https://foo.bar.com/region/myregion/1/2/3"); + slurl = LLSLURL("myregion/1/2/3"); ensure_equals(": slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" slurl, region + coords", slurl.getSLURLString(), - "https://foo.bar.com/region/myregion/1/2/3"); - + ensure_equals(" slurl, region + coords", slurl.getSLURLString(), + "https://foo.bar.com/region/myregion/1/2/3"); + slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME); ensure_equals("home", slurl.getType(), LLSLURL::HOME_LOCATION); slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST); ensure_equals("last", slurl.getType(), LLSLURL::LAST_LOCATION); - + slurl = LLSLURL("secondlife:///app/foo/bar?12345"); - ensure_equals("app", slurl.getType(), LLSLURL::APP); + ensure_equals("app", slurl.getType(), LLSLURL::APP); ensure_equals("appcmd", slurl.getAppCmd(), "foo"); ensure_equals("apppath", slurl.getAppPath().size(), 1); ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar"); ensure_equals("appquery", slurl.getAppQuery(), "12345"); - ensure_equals("grid1", "foo.bar.com", slurl.getGrid()); - + ensure_equals("grid1", slurl.getGrid(), "FooBar"); + slurl = LLSLURL("secondlife://Aditi/app/foo/bar?12345"); - ensure_equals("app", slurl.getType(), LLSLURL::APP); + ensure_equals("app", slurl.getType(), LLSLURL::APP); ensure_equals("appcmd", slurl.getAppCmd(), "foo"); ensure_equals("apppath", slurl.getAppPath().size(), 1); ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar"); ensure_equals("appquery", slurl.getAppQuery(), "12345"); - ensure_equals("grid2", "util.aditi.lindenlab.com", slurl.getGrid()); + ensure_equals("grid2", slurl.getGrid(), "Aditi"); - LLGridManager::getInstance()->setGridChoice("foo.bar.com"); + LLGridManager::getInstance()->setGridChoice("foo.bar.com"); slurl = LLSLURL("secondlife:///secondlife/myregion/1/2/3"); ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); ensure_equals("location", slurl.getType(), LLSLURL::LOCATION); ensure_equals("region" , "myregion", slurl.getRegion()); - ensure_equals("grid3", "util.agni.lindenlab.com", slurl.getGrid()); - + ensure_equals("grid3", slurl.getGrid(), "util.agni.lindenlab.com"); + slurl = LLSLURL("secondlife://Aditi/secondlife/myregion/1/2/3"); ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION); ensure_equals("location", slurl.getType(), LLSLURL::LOCATION); ensure_equals("region" , "myregion", slurl.getRegion()); - ensure_equals("grid4", "util.aditi.lindenlab.com", slurl.getGrid()); - + ensure_equals("grid4", slurl.getGrid(), "Aditi" ); + LLGridManager::getInstance()->setGridChoice("my.grid.com"); slurl = LLSLURL("https://my.grid.com/app/foo/bar?12345"); - ensure_equals("app", slurl.getType(), LLSLURL::APP); + ensure_equals("app", slurl.getType(), LLSLURL::APP); ensure_equals("appcmd", slurl.getAppCmd(), "foo"); ensure_equals("apppath", slurl.getAppPath().size(), 1); ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar"); - ensure_equals("appquery", slurl.getAppQuery(), "12345"); - + ensure_equals("appquery", slurl.getAppQuery(), "12345"); + } - + // construction from grid/region/vector combos template<> template<> void slurlTestObject::test<2>() { - LLSLURL slurl = LLSLURL("mygrid.com", "my region"); + llofstream gridfile("grid_test.xml"); + gridfile << gSampleGridFile; + gridfile.close(); + + LLGridManager::getInstance()->initialize("grid_test.xml"); + + LLSLURL slurl = LLSLURL("my.grid.com", "my region"); ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals("grid/region", slurl.getSLURLString(), - "https://mygrid.com/region/my%20region/128/128/0"); - - slurl = LLSLURL("mygrid.com", "my region", LLVector3(1,2,3)); + ensure_equals("grid/region", slurl.getSLURLString(), + "https://my.grid.com/region/my%20region/128/128/0"); + + slurl = LLSLURL("my.grid.com", "my region", LLVector3(1,2,3)); ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" grid/region/vector", slurl.getSLURLString(), - "https://mygrid.com/region/my%20region/1/2/3"); + ensure_equals(" grid/region/vector", slurl.getSLURLString(), + "https://my.grid.com/region/my%20region/1/2/3"); - LLGridManager::getInstance()->setGridChoice("foo.bar.com.bar"); + LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); slurl = LLSLURL("my region", LLVector3(1,2,3)); - ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" grid/region/vector", slurl.getSLURLString(), - "https://foo.bar.com.bar/region/my%20region/1/2/3"); - - LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); + ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); + ensure_equals(" default grid/region/vector", slurl.getSLURLString(), + "http://maps.secondlife.com/secondlife/my%20region/1/2/3"); + + LLGridManager::getInstance()->setGridChoice("MyGrid"); slurl = LLSLURL("my region", LLVector3(1,2,3)); ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION); - ensure_equals(" default grid/region/vector", slurl.getSLURLString(), - "http://maps.secondlife.com/secondlife/my%20region/1/2/3"); - + ensure_equals(" default grid/region/vector", slurl.getSLURLString(), + "https://my.grid.com/region/my%20region/1/2/3"); + } // Accessors template<> template<> void slurlTestObject::test<3>() { - LLGridManager::getInstance()->setGridChoice("my.grid.com"); + llofstream gridfile("grid_test.xml"); + gridfile << gSampleGridFile; + gridfile.close(); + + LLGridManager::getInstance()->initialize("grid_test.xml"); + + LLGridManager::getInstance()->setGridChoice("my.grid.com"); LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3"); ensure_equals("login string", slurl.getLoginString(), "uri:my region&1&2&3"); ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3"); ensure_equals("grid", slurl.getGrid(), "my.grid.com"); ensure_equals("region", slurl.getRegion(), "my region"); ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3)); - + } } diff --git a/indra/newview/tests/lltextureinfo_test.cpp b/indra/newview/tests/lltextureinfo_test.cpp index 73ace1de37..73ace1de37 100644..100755 --- a/indra/newview/tests/lltextureinfo_test.cpp +++ b/indra/newview/tests/lltextureinfo_test.cpp diff --git a/indra/newview/tests/lltextureinfodetails_test.cpp b/indra/newview/tests/lltextureinfodetails_test.cpp index 31ec5f9d4e..31ec5f9d4e 100644..100755 --- a/indra/newview/tests/lltextureinfodetails_test.cpp +++ b/indra/newview/tests/lltextureinfodetails_test.cpp diff --git a/indra/newview/tests/lltexturestatsuploader_test.cpp b/indra/newview/tests/lltexturestatsuploader_test.cpp index cfb2c267cc..cfb2c267cc 100644..100755 --- a/indra/newview/tests/lltexturestatsuploader_test.cpp +++ b/indra/newview/tests/lltexturestatsuploader_test.cpp diff --git a/indra/newview/tests/lltranslate_test.cpp b/indra/newview/tests/lltranslate_test.cpp index 10e37fae97..8ce56326d8 100644..100755 --- a/indra/newview/tests/lltranslate_test.cpp +++ b/indra/newview/tests/lltranslate_test.cpp @@ -299,11 +299,6 @@ LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLCo std::string LLControlGroup::getString(const std::string& name) { return "dummy"; } LLControlGroup::~LLControlGroup() {} -namespace boost { - void intrusive_ptr_add_ref(LLCurl::Responder*) {} - void intrusive_ptr_release(LLCurl::Responder*) {} -} - LLCurl::Responder::Responder() {} void LLCurl::Responder::completedHeader(U32, std::string const&, LLSD const&) {} void LLCurl::Responder::completedRaw(U32, const std::string&, const LLChannelDescriptors&, const LLIOPipe::buffer_ptr_t& buffer) {} @@ -313,8 +308,8 @@ void LLCurl::Responder::errorWithContent(U32, std::string const&, LLSD const&) { void LLCurl::Responder::result(LLSD const&) {} LLCurl::Responder::~Responder() {} -void LLHTTPClient::get(const std::string&, const LLSD&, ResponderPtr, const LLSD&, const F32) {} -void LLHTTPClient::get(const std::string&, boost::intrusive_ptr<LLCurl::Responder>, const LLSD&, const F32) {} +void LLHTTPClient::get(const std::string&, const LLSD&, ResponderPtr, const LLSD&, const F32, bool) {} +void LLHTTPClient::get(const std::string&, LLPointer<LLCurl::Responder>, const LLSD&, const F32, bool) {} LLBufferStream::LLBufferStream(const LLChannelDescriptors& channels, LLBufferArray* buffer) : std::iostream(&mStreamBuf), mStreamBuf(channels, buffer) {} diff --git a/indra/newview/tests/llversioninfo_test.cpp b/indra/newview/tests/llversioninfo_test.cpp index 398d8f16ed..6b0be29c2d 100644..100755 --- a/indra/newview/tests/llversioninfo_test.cpp +++ b/indra/newview/tests/llversioninfo_test.cpp @@ -28,7 +28,6 @@ #include "../test/lltut.h" #include "../llversioninfo.h" -#include "llversionviewer.h" namespace tut { @@ -38,20 +37,20 @@ namespace tut : mResetChannel("Reset Channel") { std::ostringstream stream; - stream << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VERSION_BUILD; + stream << LL_VIEWER_VERSION_MAJOR << "." + << LL_VIEWER_VERSION_MINOR << "." + << LL_VIEWER_VERSION_PATCH << "." + << LL_VIEWER_VERSION_BUILD; mVersion = stream.str(); stream.str(""); - stream << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH; + stream << LL_VIEWER_VERSION_MAJOR << "." + << LL_VIEWER_VERSION_MINOR << "." + << LL_VIEWER_VERSION_PATCH; mShortVersion = stream.str(); stream.str(""); - stream << LL_CHANNEL + stream << LL_VIEWER_CHANNEL << " " << mVersion; mVersionAndChannel = stream.str(); @@ -78,20 +77,19 @@ namespace tut { ensure_equals("Major version", LLVersionInfo::getMajor(), - LL_VERSION_MAJOR); + LL_VIEWER_VERSION_MAJOR); ensure_equals("Minor version", LLVersionInfo::getMinor(), - LL_VERSION_MINOR); + LL_VIEWER_VERSION_MINOR); ensure_equals("Patch version", LLVersionInfo::getPatch(), - LL_VERSION_PATCH); + LL_VIEWER_VERSION_PATCH); ensure_equals("Build version", LLVersionInfo::getBuild(), - LL_VERSION_BUILD); + LL_VIEWER_VERSION_BUILD); ensure_equals("Channel version", LLVersionInfo::getChannel(), - LL_CHANNEL); - + LL_VIEWER_CHANNEL); ensure_equals("Version String", LLVersionInfo::getVersion(), mVersion); diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index 3faddc13c1..a331d9aa9e 100644..100755 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -35,6 +35,7 @@ #include "lluuid.h" #include "llsdutil.h" #include "llregionhandle.h" +#include "../llvoavatar.h" static const char * all_keys[] = { @@ -98,7 +99,9 @@ is_empty_map(const LLSD & sd) { return sd.isMap() && 0 == sd.size(); } +#endif +#if 0 static bool is_single_key_map(const LLSD & sd, const std::string & key) { @@ -112,6 +115,14 @@ is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2); } +#if 0 +static bool +is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & key2, const std::string& key3) +{ + return sd.isMap() && 3 == sd.size() && sd.has(key1) && sd.has(key2) && sd.has(key3); +} +#endif + static bool is_no_stats_map(const LLSD & sd) { diff --git a/indra/newview/tests/llviewerhelputil_test.cpp b/indra/newview/tests/llviewerhelputil_test.cpp index 710881d811..f6456a2839 100644..100755 --- a/indra/newview/tests/llviewerhelputil_test.cpp +++ b/indra/newview/tests/llviewerhelputil_test.cpp @@ -49,10 +49,10 @@ static std::string gOS; LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) {} LLControlGroup::~LLControlGroup() {} -BOOL LLControlGroup::declareString(const std::string& name, +LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, - BOOL persist) {return TRUE;} + LLControlVariable::ePersist persist) {return NULL;} void LLControlGroup::setString(const std::string& name, const std::string& val){} std::string LLControlGroup::getString(const std::string& name) { diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index 3c89b64d52..7ad7947ca4 100644..100755 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -1,4 +1,4 @@ -/** +/** * @file llviewernetwork_test.cpp * @author Roxie * @date 2009-03-9 @@ -7,21 +7,21 @@ * $LicenseInfo:firstyear=2009&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -31,16 +31,16 @@ #include "../../llxml/llcontrol.h" #include "llfile.h" -//---------------------------------------------------------------------------- -// Mock objects for the dependencies of the code we're testing +//---------------------------------------------------------------------------- +// Mock objects for the dependencies of the code we're testing LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) {} LLControlGroup::~LLControlGroup() {} -BOOL LLControlGroup::declareString(const std::string& name, +LLControlVariable* LLControlGroup::declareString(const std::string& name, const std::string& initial_val, const std::string& comment, - BOOL persist) {return TRUE;} + LLControlVariable::ePersist persist) {return NULL;} void LLControlGroup::setString(const std::string& name, const std::string& val){} std::string gCmdLineLoginURI; @@ -81,26 +81,58 @@ LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name) LLControlGroup gSavedSettings("test"); -const char *gSampleGridFile = "<llsd><map>" -"<key>grid1</key><map>" -" <key>favorite</key><integer>1</integer>" -" <key>helper_uri</key><string>https://helper1/helpers/</string>" -" <key>label</key><string>mylabel</string>" -" <key>login_page</key><string>loginpage</string>" -" <key>login_uri</key><array><string>myloginuri</string></array>" -" <key>name</key><string>grid1</string>" -" <key>visible</key><integer>1</integer>" -" <key>credential_type</key><string>agent</string>" -" <key>grid_login_id</key><string>MyGrid</string>" -"</map>" -"<key>util.agni.lindenlab.com</key><map>" -" <key>favorite</key><integer>1</integer>" -" <key>helper_uri</key><string>https://helper1/helpers/</string>" -" <key>label</key><string>mylabel</string>" -" <key>login_page</key><string>loginpage</string>" -" <key>login_uri</key><array><string>myloginuri</string></array>" -" <key>name</key><string>util.agni.lindenlab.com</string>" -"</map></map></llsd>"; +const char *gSampleGridFile = + "<?xml version=\"1.0\"?>" + "<llsd>" + " <map>" + " <key>altgrid.long.name</key>" + " <map>" + " <key>helper_uri</key><string>https://helper1/helpers/</string>" + " <key>label</key><string>Alternative Grid</string>" + " <key>login_page</key><string>altgrid/loginpage</string>" + " <key>login_uri</key>" + " <array>" + " <string>altgrid/myloginuri1</string>" + " <string>altgrid/myloginuri2</string>" + " </array>" + " <key>keyname</key><string>altgrid.long.name</string>" + " <key>credential_type</key><string>agent</string>" + " <key>grid_login_id</key><string>AltGrid</string>" + " </map>" + " <key>minimal.long.name</key>" + " <map>" + " <key>keyname</key><string>minimal.long.name</string>" + " </map>" + " <!-- Note that the values for agni and aditi below are deliberately" + " incorrect to test that they are not overwritten -->" + " <key>util.agni.lindenlab.com</key> <!-- conflict -->" + " <map>" + " <key>helper_uri</key><string>https://helper1/helpers/</string>" + " <key>grid_login_id</key><string>mylabel</string>" + " <key>label</key><string>mylabel</string>" + " <key>login_page</key><string>loginpage</string>" + " <key>login_uri</key>" + " <array>" + " <string>myloginuri</string>" + " </array>" + " <key>keyname</key><string>util.agni.lindenlab.com</string> <!-- conflict -->" + " </map>" + " <key>util.foobar.lindenlab.com</key>" + " <map>" + " <key>helper_uri</key><string>https://helper1/helpers/</string>" + " <key>grid_login_id</key><string>Aditi</string> <!-- conflict -->" + " <key>label</key><string>mylabel</string>" + " <key>login_page</key><string>loginpage</string>" + " <key>login_uri</key>" + " <array>" + " <string>myloginuri</string>" + " </array>" + " <key>update_query_url_base</key><string>https://update.secondlife.com/update</string>" + " <key>keyname</key><string>util.foobar.lindenlab.com</string>" + " </map>" + " </map>" + "</llsd>" + ; // ------------------------------------------------------------------------------------------- // TUT // ------------------------------------------------------------------------------------------- @@ -116,63 +148,92 @@ namespace tut gCmdLineGridChoice.clear(); gCmdLineHelperURI.clear(); gLoginPage.clear(); - gCurrentGrid.clear(); + gCurrentGrid.clear(); } ~viewerNetworkTest() { LLFile::remove("grid_test.xml"); } }; - + // Tut templating thingamagic: test group, object and test instance typedef test_group<viewerNetworkTest> viewerNetworkTestFactory; typedef viewerNetworkTestFactory::object viewerNetworkTestObject; tut::viewerNetworkTestFactory tut_test("LLViewerNetwork"); - + // --------------------------------------------------------------------------------------- - // Test functions + // Test functions // --------------------------------------------------------------------------------------- // initialization without a grid file template<> template<> void viewerNetworkTestObject::test<1>() { - LLGridManager *manager = LLGridManager::getInstance(); // grid file doesn't exist manager->initialize("grid_test.xml"); // validate that some of the defaults are available. std::map<std::string, std::string> known_grids = manager->getKnownGrids(); - ensure_equals("Known grids is a string-string map of size 23", known_grids.size(), 23); - ensure_equals("Agni has the right name and label", - known_grids[std::string("util.agni.lindenlab.com")], std::string("Agni")); - ensure_equals("None exists", known_grids[""], "None"); - - LLSD grid; - LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com", grid); - ensure("Grid info for agni is a map", grid.isMap()); - ensure_equals("name is correct for agni", - grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com")); - ensure_equals("label is correct for agni", - grid[GRID_LABEL_VALUE].asString(), std::string("Agni")); - ensure("Login URI is an array", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("Agni login uri is correct", - grid[GRID_LOGIN_URI_VALUE][0].asString(), + ensure_equals("Known grids is a string-string map of size 2", known_grids.size(), 2); + ensure_equals("Agni has the right name and label", + known_grids[std::string("util.agni.lindenlab.com")], + std::string("Second Life Main Grid (Agni)")); + ensure_equals("Aditi has the right name and label", + known_grids[std::string("util.aditi.lindenlab.com")], + std::string("Second Life Beta Test Grid (Aditi)")); + ensure_equals("name for agni", + LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"), + std::string("util.agni.lindenlab.com")); + ensure_equals("id for agni", + std::string("Agni"), + LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com")); + ensure_equals("update url base for Agni", // relies on agni being the default + std::string("https://update.secondlife.com/update"), + LLGridManager::getInstance()->getUpdateServiceURL()); + ensure_equals("label for agni", + LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"), + std::string("Second Life Main Grid (Agni)")); + + std::vector<std::string> login_uris; + LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris); + ensure_equals("Number of login uris for agni", 1, login_uris.size()); + ensure_equals("Agni login uri", + login_uris[0], std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); - ensure_equals("Agni helper uri is correct", - grid[GRID_HELPER_URI_VALUE].asString(), + ensure_equals("Agni helper uri", + LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"), std::string("https://secondlife.com/helpers/")); - ensure_equals("Agni login page is correct", - grid[GRID_LOGIN_PAGE_VALUE].asString(), + ensure_equals("Agni login page", + LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), std::string("http://viewer-login.agni.lindenlab.com/")); - ensure("Agni is a favorite", - grid.has(GRID_IS_FAVORITE_VALUE)); - ensure("Agni is a system grid", - grid.has(GRID_IS_SYSTEM_GRID_VALUE)); - ensure("Grid file wasn't greated as it wasn't saved", - !LLFile::isfile("grid_test.xml")); + ensure("Agni is a system grid", + LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com")); + + ensure_equals("name for aditi", + LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"), + std::string("util.aditi.lindenlab.com")); + ensure_equals("id for aditi", + LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"), + std::string("Aditi")); + ensure_equals("label for aditi", + LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"), + std::string("Second Life Beta Test Grid (Aditi)")); + + LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris); + + ensure_equals("Number of login uris for aditi", 1, login_uris.size()); + ensure_equals("Aditi login uri", + login_uris[0], + std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi")); + ensure_equals("Aditi helper uri", + LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"), + std::string("http://aditi-secondlife.webdev.lindenlab.com/helpers/")); + ensure_equals("Aditi login page", + LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"), + std::string("http://viewer-login.agni.lindenlab.com/")); + ensure("Aditi is a system grid", + LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com")); } - + // initialization with a grid file template<> template<> void viewerNetworkTestObject::test<2>() @@ -180,402 +241,178 @@ namespace tut llofstream gridfile("grid_test.xml"); gridfile << gSampleGridFile; gridfile.close(); - + LLGridManager::getInstance()->initialize("grid_test.xml"); std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure_equals("adding a grid via a grid file increases known grid size", - known_grids.size(), 24); - ensure_equals("Agni is still there after we've added a grid via a grid file", - known_grids["util.agni.lindenlab.com"], std::string("Agni")); - - - // assure Agni doesn't get overwritten - LLSD grid; - LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com", grid); + ensure_equals("adding a grid via a grid file increases known grid size",4, + known_grids.size()); - ensure_equals("Agni grid label was not modified by grid file", - grid[GRID_LABEL_VALUE].asString(), std::string("Agni")); - - ensure_equals("Agni name wasn't modified by grid file", - grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com")); - ensure("Agni grid URI is still an array after grid file", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("Agni login uri still the same after grid file", - grid[GRID_LOGIN_URI_VALUE][0].asString(), + // Verify that Agni and Aditi were not overwritten + ensure_equals("Agni has the right name and label", + known_grids[std::string("util.agni.lindenlab.com")], + std::string("Second Life Main Grid (Agni)")); + ensure_equals("Aditi has the right name and label", + known_grids[std::string("util.aditi.lindenlab.com")], + std::string("Second Life Beta Test Grid (Aditi)")); + ensure_equals("name for agni", + LLGridManager::getInstance()->getGrid("util.agni.lindenlab.com"), + std::string("util.agni.lindenlab.com")); + ensure_equals("id for agni", + LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"), + std::string("Agni")); + ensure_equals("update url base for Agni", // relies on agni being the default + std::string("https://update.secondlife.com/update"), + LLGridManager::getInstance()->getUpdateServiceURL()); + ensure_equals("label for agni", + LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"), + std::string("Second Life Main Grid (Agni)")); + std::vector<std::string> login_uris; + LLGridManager::getInstance()->getLoginURIs(std::string("util.agni.lindenlab.com"), login_uris); + ensure_equals("Number of login uris for agni", 1, login_uris.size()); + ensure_equals("Agni login uri", + login_uris[0], std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); - ensure_equals("Agni helper uri still the same after grid file", - grid[GRID_HELPER_URI_VALUE].asString(), + ensure_equals("Agni helper uri", + LLGridManager::getInstance()->getHelperURI("util.agni.lindenlab.com"), std::string("https://secondlife.com/helpers/")); - ensure_equals("Agni login page the same after grid file", - grid[GRID_LOGIN_PAGE_VALUE].asString(), + ensure_equals("Agni login page", + LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), std::string("http://viewer-login.agni.lindenlab.com/")); - ensure("Agni still a favorite after grid file", - grid.has(GRID_IS_FAVORITE_VALUE)); - ensure("Agni system grid still set after grid file", - grid.has(GRID_IS_SYSTEM_GRID_VALUE)); - - ensure_equals("Grid file adds to name<->label map", - known_grids["grid1"], std::string("mylabel")); - LLGridManager::getInstance()->getGridInfo("grid1", grid); - ensure_equals("grid file grid name is set", - grid[GRID_VALUE].asString(), std::string("grid1")); - ensure_equals("grid file label is set", - grid[GRID_LABEL_VALUE].asString(), std::string("mylabel")); - ensure("grid file login uri is an array", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("grid file login uri is set", - grid[GRID_LOGIN_URI_VALUE][0].asString(), - std::string("myloginuri")); - ensure_equals("grid file helper uri is set", - grid[GRID_HELPER_URI_VALUE].asString(), - std::string("https://helper1/helpers/")); - ensure_equals("grid file login page is set", - grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("loginpage")); - ensure("grid file favorite is set", - grid.has(GRID_IS_FAVORITE_VALUE)); - ensure("grid file isn't a system grid", - !grid.has(GRID_IS_SYSTEM_GRID_VALUE)); - ensure("Grid file still exists after loading", - LLFile::isfile("grid_test.xml")); - } - - // Initialize via command line - - template<> template<> - void viewerNetworkTestObject::test<3>() - { - // USE --grid command line - // initialize with a known grid - LLSD grid; - gCmdLineGridChoice = "Aditi"; - LLGridManager::getInstance()->initialize("grid_test.xml"); - // with single login uri specified. - std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure_equals("Using a known grid via command line doesn't increase number of known grids", - known_grids.size(), 23); - ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Aditi")); - // initialize with a known grid in lowercase - gCmdLineGridChoice = "agni"; - LLGridManager::getInstance()->initialize("grid_test.xml"); - ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Agni")); - - // now try a command line with a custom grid identifier - gCmdLineGridChoice = "mycustomgridchoice"; - LLGridManager::getInstance()->initialize("grid_test.xml"); - known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure_equals("adding a command line grid with custom name increases known grid size", - known_grids.size(), 24); - ensure_equals("Custom Command line grid is added to the list of grids", - known_grids["mycustomgridchoice"], std::string("mycustomgridchoice")); - LLGridManager::getInstance()->getGridInfo("mycustomgridchoice", grid); - ensure_equals("Custom Command line grid name is set", - grid[GRID_VALUE].asString(), std::string("mycustomgridchoice")); - ensure_equals("Custom Command line grid label is set", - grid[GRID_LABEL_VALUE].asString(), std::string("mycustomgridchoice")); - ensure("Custom Command line grid login uri is an array", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("Custom Command line grid login uri is set", - grid[GRID_LOGIN_URI_VALUE][0].asString(), - std::string("https://mycustomgridchoice/cgi-bin/login.cgi")); - ensure_equals("Custom Command line grid helper uri is set", - grid[GRID_HELPER_URI_VALUE].asString(), - std::string("https://mycustomgridchoice/helpers/")); - ensure_equals("Custom Command line grid login page is set", - grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://mycustomgridchoice/app/login/")); - } - - // validate override of login uri with cmd line - template<> template<> - void viewerNetworkTestObject::test<4>() - { - // Override with loginuri - // override known grid - LLSD grid; - gCmdLineGridChoice = "Aditi"; - gCmdLineLoginURI = "https://my.login.uri/cgi-bin/login.cgi"; - LLGridManager::getInstance()->initialize("grid_test.xml"); - std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure_equals("Override known grid login uri: No grids are added", - known_grids.size(), 23); - LLGridManager::getInstance()->getGridInfo(grid); - ensure("Override known grid login uri: login uri is an array", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("Override known grid login uri: Command line grid login uri is set", - grid[GRID_LOGIN_URI_VALUE][0].asString(), - std::string("https://my.login.uri/cgi-bin/login.cgi")); - ensure_equals("Override known grid login uri: helper uri is not changed", - grid[GRID_HELPER_URI_VALUE].asString(), - std::string("http://aditi-secondlife.webdev.lindenlab.com/helpers/")); - ensure_equals("Override known grid login uri: login page is not set", - grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://viewer-login.agni.lindenlab.com/")); - - // Override with loginuri - // override custom grid - gCmdLineGridChoice = "mycustomgridchoice"; - gCmdLineLoginURI = "https://my.login.uri/cgi-bin/login.cgi"; - LLGridManager::getInstance()->initialize("grid_test.xml"); - known_grids = LLGridManager::getInstance()->getKnownGrids(); - LLGridManager::getInstance()->getGridInfo(grid); - ensure_equals("Override custom grid login uri: Grid is added", - known_grids.size(), 24); - ensure("Override custom grid login uri: login uri is an array", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("Override custom grid login uri: login uri is set", - grid[GRID_LOGIN_URI_VALUE][0].asString(), - std::string("https://my.login.uri/cgi-bin/login.cgi")); - ensure_equals("Override custom grid login uri: Helper uri is not set", - grid[GRID_HELPER_URI_VALUE].asString(), - std::string("https://mycustomgridchoice/helpers/")); - ensure_equals("Override custom grid login uri: Login page is not set", - grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://mycustomgridchoice/app/login/")); - } - - // validate override of helper uri with cmd line - template<> template<> - void viewerNetworkTestObject::test<5>() - { - // Override with helperuri - // override known grid - LLSD grid; - gCmdLineGridChoice = "Aditi"; - gCmdLineLoginURI = ""; - gCmdLineHelperURI = "https://my.helper.uri/mycustomhelpers"; - LLGridManager::getInstance()->initialize("grid_test.xml"); - std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure_equals("Override known grid helper uri: No grids are added", - known_grids.size(), 23); - LLGridManager::getInstance()->getGridInfo(grid); - ensure("Override known known helper uri: login uri is an array", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("Override known grid helper uri: login uri is not changed", - grid[GRID_LOGIN_URI_VALUE][0].asString(), - std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi")); - ensure_equals("Override known grid helper uri: helper uri is changed", - grid[GRID_HELPER_URI_VALUE].asString(), - std::string("https://my.helper.uri/mycustomhelpers")); - ensure_equals("Override known grid helper uri: login page is not changed", - grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://viewer-login.agni.lindenlab.com/")); - - // Override with helperuri - // override custom grid - gCmdLineGridChoice = "mycustomgridchoice"; - gCmdLineHelperURI = "https://my.helper.uri/mycustomhelpers"; - LLGridManager::getInstance()->initialize("grid_test.xml"); - known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure_equals("Override custom grid helper uri: grids is added", - known_grids.size(), 24); - LLGridManager::getInstance()->getGridInfo(grid); - ensure("Override custom helper uri: login uri is an array", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("Override custom grid helper uri: login uri is not changed", - grid[GRID_LOGIN_URI_VALUE][0].asString(), - std::string("https://mycustomgridchoice/cgi-bin/login.cgi")); - ensure_equals("Override custom grid helper uri: helper uri is changed", - grid[GRID_HELPER_URI_VALUE].asString(), - std::string("https://my.helper.uri/mycustomhelpers")); - ensure_equals("Override custom grid helper uri: login page is not changed", - grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://mycustomgridchoice/app/login/")); - } - - // validate overriding of login page via cmd line - template<> template<> - void viewerNetworkTestObject::test<6>() - { - // Override with login page - // override known grid - LLSD grid; - gCmdLineGridChoice = "Aditi"; - gCmdLineHelperURI = ""; - gLoginPage = "myloginpage"; - LLGridManager::getInstance()->initialize("grid_test.xml"); - std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure_equals("Override known grid login page: No grids are added", - known_grids.size(), 23); - LLGridManager::getInstance()->getGridInfo(grid); - ensure("Override known grid login page: Command line grid login uri is an array", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("Override known grid login page: login uri is not changed", - grid[GRID_LOGIN_URI_VALUE][0].asString(), + ensure("Agni is a system grid", + LLGridManager::getInstance()->isSystemGrid("util.agni.lindenlab.com")); + + ensure_equals("name for aditi", + LLGridManager::getInstance()->getGrid("util.aditi.lindenlab.com"), + std::string("util.aditi.lindenlab.com")); + ensure_equals("id for aditi", + LLGridManager::getInstance()->getGridId("util.aditi.lindenlab.com"), + std::string("Aditi")); + ensure_equals("label for aditi", + LLGridManager::getInstance()->getGridLabel("util.aditi.lindenlab.com"), + std::string("Second Life Beta Test Grid (Aditi)")); + + LLGridManager::getInstance()->getLoginURIs(std::string("util.aditi.lindenlab.com"), login_uris); + ensure_equals("Number of login uris for aditi", 1, login_uris.size()); + ensure_equals("Aditi login uri", + login_uris[0], std::string("https://login.aditi.lindenlab.com/cgi-bin/login.cgi")); - ensure_equals("Override known grid login page: helper uri is not changed", - grid[GRID_HELPER_URI_VALUE].asString(), + ensure_equals("Aditi helper uri", + LLGridManager::getInstance()->getHelperURI("util.aditi.lindenlab.com"), std::string("http://aditi-secondlife.webdev.lindenlab.com/helpers/")); - ensure_equals("Override known grid login page: login page is changed", - grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("myloginpage")); - - // Override with login page - // override custom grid - gCmdLineGridChoice = "mycustomgridchoice"; - gLoginPage = "myloginpage"; - LLGridManager::getInstance()->initialize("grid_test.xml"); - known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure_equals("Override custom grid login page: grids are added", - known_grids.size(), 24); - LLGridManager::getInstance()->getGridInfo(grid); - ensure("Override custom grid login page: Command line grid login uri is an array", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("Override custom grid login page: login uri is not changed", - grid[GRID_LOGIN_URI_VALUE][0].asString(), - std::string("https://mycustomgridchoice/cgi-bin/login.cgi")); - ensure_equals("Override custom grid login page: helper uri is not changed", - grid[GRID_HELPER_URI_VALUE].asString(), - std::string("https://mycustomgridchoice/helpers/")); - ensure_equals("Override custom grid login page: login page is changed", - grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("myloginpage")); - + ensure_equals("Aditi login page", + LLGridManager::getInstance()->getLoginPage("util.aditi.lindenlab.com"), + std::string("http://viewer-login.agni.lindenlab.com/")); + ensure("Aditi is a system grid", + LLGridManager::getInstance()->isSystemGrid("util.aditi.lindenlab.com")); + + // Check the additional grid from the file + ensure_equals("alternative grid is in name<->label map", + known_grids["altgrid.long.name"], + std::string("Alternative Grid")); + ensure_equals("alternative grid name is set", + LLGridManager::getInstance()->getGrid("altgrid.long.name"), + std::string("altgrid.long.name")); + ensure_equals("alternative grid id", + LLGridManager::getInstance()->getGridId("altgrid.long.name"), + std::string("AltGrid")); + ensure_equals("alternative grid label", + LLGridManager::getInstance()->getGridLabel("altgrid.long.name"), + std::string("Alternative Grid")); + std::vector<std::string> alt_login_uris; + LLGridManager::getInstance()->getLoginURIs(std::string("altgrid.long.name"), alt_login_uris); + ensure_equals("Number of login uris for altgrid", 2, alt_login_uris.size()); + ensure_equals("alternative grid first login uri", + alt_login_uris[0], + std::string("altgrid/myloginuri1")); + ensure_equals("alternative grid second login uri", + alt_login_uris[1], + std::string("altgrid/myloginuri2")); + ensure_equals("alternative grid helper uri", + LLGridManager::getInstance()->getHelperURI("altgrid.long.name"), + std::string("https://helper1/helpers/")); + ensure_equals("alternative grid login page", + LLGridManager::getInstance()->getLoginPage("altgrid.long.name"), + std::string("altgrid/loginpage")); + ensure("alternative grid is NOT a system grid", + ! LLGridManager::getInstance()->isSystemGrid("altgrid.long.name")); + + ensure_equals("minimal grid is in name<->label map", + known_grids["minimal.long.name"], + std::string("minimal.long.name")); + ensure_equals("minimal grid name is set", + LLGridManager::getInstance()->getGrid("minimal.long.name"), + std::string("minimal.long.name")); + ensure_equals("minimal grid id", + LLGridManager::getInstance()->getGridId("minimal.long.name"), + std::string("minimal.long.name")); + ensure_equals("minimal grid label", + LLGridManager::getInstance()->getGridLabel("minimal.long.name"), + std::string("minimal.long.name")); + + LLGridManager::getInstance()->getLoginURIs(std::string("minimal.long.name"), alt_login_uris); + ensure_equals("Number of login uris for altgrid", 1, alt_login_uris.size()); + ensure_equals("minimal grid login uri", + alt_login_uris[0], + std::string("https://minimal.long.name/cgi-bin/login.cgi")); + ensure_equals("minimal grid helper uri", + LLGridManager::getInstance()->getHelperURI("minimal.long.name"), + std::string("https://minimal.long.name/helpers/")); + ensure_equals("minimal grid login page", + LLGridManager::getInstance()->getLoginPage("minimal.long.name"), + std::string("http://minimal.long.name/app/login/")); + } - + + // validate grid selection template<> template<> void viewerNetworkTestObject::test<7>() - { - LLSD loginURI = LLSD::emptyArray(); - LLSD grid = LLSD::emptyMap(); + { // adding a grid with simply a name will populate the values. - grid[GRID_VALUE] = "myaddedgrid"; + llofstream gridfile("grid_test.xml"); + gridfile << gSampleGridFile; + gridfile.close(); LLGridManager::getInstance()->initialize("grid_test.xml"); - LLGridManager::getInstance()->addGrid(grid); - LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); - ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Agni")); - ensure_equals("getGrid", LLGridManager::getInstance()->getGrid(), + + LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com"); + ensure_equals("getGridLabel", + LLGridManager::getInstance()->getGridLabel(), + std::string("Second Life Main Grid (Agni)")); + ensure_equals("getGridId", + LLGridManager::getInstance()->getGridId(), + std::string("Agni")); + ensure_equals("getGrid", + LLGridManager::getInstance()->getGrid(), std::string("util.agni.lindenlab.com")); - ensure_equals("getHelperURI", LLGridManager::getInstance()->getHelperURI(), + ensure_equals("getHelperURI", + LLGridManager::getInstance()->getHelperURI(), std::string("https://secondlife.com/helpers/")); - ensure_equals("getLoginPage", LLGridManager::getInstance()->getLoginPage(), + ensure_equals("getLoginPage", + LLGridManager::getInstance()->getLoginPage(), std::string("http://viewer-login.agni.lindenlab.com/")); - ensure_equals("getLoginPage2", LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), - std::string("http://viewer-login.agni.lindenlab.com/")); - ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid()); + ensure_equals("update url base for Agni", // relies on agni being the default + std::string("https://update.secondlife.com/update"), + LLGridManager::getInstance()->getUpdateServiceURL()); + ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid()); std::vector<std::string> uris; LLGridManager::getInstance()->getLoginURIs(uris); - ensure_equals("getLoginURIs size", uris.size(), 1); - ensure_equals("getLoginURIs", uris[0], + ensure_equals("getLoginURIs size", 1, uris.size()); + ensure_equals("getLoginURIs", + uris[0], std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi")); - LLGridManager::getInstance()->setGridChoice("myaddedgrid"); - ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("myaddedgrid")); - ensure("Is myaddedgrid a production grid", !LLGridManager::getInstance()->isInProductionGrid()); - - LLGridManager::getInstance()->setFavorite(); - LLGridManager::getInstance()->getGridInfo("myaddedgrid", grid); - ensure("setting favorite", grid.has(GRID_IS_FAVORITE_VALUE)); - } - - // name based grid population - template<> template<> - void viewerNetworkTestObject::test<8>() - { - LLGridManager::getInstance()->initialize("grid_test.xml"); - LLSD grid = LLSD::emptyMap(); - // adding a grid with simply a name will populate the values. - grid[GRID_VALUE] = "myaddedgrid"; - LLGridManager::getInstance()->addGrid(grid); - LLGridManager::getInstance()->getGridInfo("myaddedgrid", grid); - - ensure_equals("name based grid has name value", - grid[GRID_VALUE].asString(), - std::string("myaddedgrid")); - ensure_equals("name based grid has label value", - grid[GRID_LABEL_VALUE].asString(), - std::string("myaddedgrid")); - ensure_equals("name based grid has name value", - grid[GRID_HELPER_URI_VALUE].asString(), - std::string("https://myaddedgrid/helpers/")); - ensure_equals("name based grid has name value", - grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://myaddedgrid/app/login/")); - ensure("name based grid has array loginuri", - grid[GRID_LOGIN_URI_VALUE].isArray()); - ensure_equals("name based grid has single login uri value", - grid[GRID_LOGIN_URI_VALUE].size(), 1); - ensure_equals("Name based grid login uri is correct", - grid[GRID_LOGIN_URI_VALUE][0].asString(), - std::string("https://myaddedgrid/cgi-bin/login.cgi")); - ensure("name based grid is not a favorite yet", - !grid.has(GRID_IS_FAVORITE_VALUE)); - ensure("name based grid does not have system setting", - !grid.has(GRID_IS_SYSTEM_GRID_VALUE)); - - llofstream gridfile("grid_test.xml"); - gridfile << gSampleGridFile; - gridfile.close(); - } - - // persistence of the grid list with an empty gridfile. - template<> template<> - void viewerNetworkTestObject::test<9>() - { - // try with initial grid list without a grid file, - // without setting the grid to a saveable favorite. - LLGridManager::getInstance()->initialize("grid_test.xml"); - LLSD grid = LLSD::emptyMap(); - grid[GRID_VALUE] = std::string("mynewgridname"); - LLGridManager::getInstance()->addGrid(grid); - LLGridManager::getInstance()->saveFavorites(); - ensure("Grid file exists after saving", - LLFile::isfile("grid_test.xml")); - LLGridManager::getInstance()->initialize("grid_test.xml"); - // should not be there - std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure("New grid wasn't added to persisted list without being marked a favorite", - known_grids.find(std::string("mynewgridname")) == known_grids.end()); - - // mark a grid a favorite to make sure it's persisted - LLGridManager::getInstance()->addGrid(grid); - LLGridManager::getInstance()->setGridChoice("mynewgridname"); - LLGridManager::getInstance()->setFavorite(); - LLGridManager::getInstance()->saveFavorites(); - ensure("Grid file exists after saving", - LLFile::isfile("grid_test.xml")); - LLGridManager::getInstance()->initialize("grid_test.xml"); - // should not be there - known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure("New grid wasn't added to persisted list after being marked a favorite", - known_grids.find(std::string("mynewgridname")) != - known_grids.end()); - } - - // persistence of the grid file with existing gridfile - template<> template<> - void viewerNetworkTestObject::test<10>() - { - - llofstream gridfile("grid_test.xml"); - gridfile << gSampleGridFile; - gridfile.close(); - - LLGridManager::getInstance()->initialize("grid_test.xml"); - LLSD grid = LLSD::emptyMap(); - grid[GRID_VALUE] = std::string("mynewgridname"); - LLGridManager::getInstance()->addGrid(grid); - LLGridManager::getInstance()->saveFavorites(); - // validate we didn't lose existing favorites - LLGridManager::getInstance()->initialize("grid_test.xml"); - std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure("New grid wasn't added to persisted list after being marked a favorite", - known_grids.find(std::string("grid1")) != - known_grids.end()); - - // add a grid - LLGridManager::getInstance()->addGrid(grid); - LLGridManager::getInstance()->setGridChoice("mynewgridname"); - LLGridManager::getInstance()->setFavorite(); - LLGridManager::getInstance()->saveFavorites(); - known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure("New grid wasn't added to persisted list after being marked a favorite", - known_grids.find(std::string("grid1")) != - known_grids.end()); - known_grids = LLGridManager::getInstance()->getKnownGrids(); - ensure("New grid wasn't added to persisted list after being marked a favorite", - known_grids.find(std::string("mynewgridname")) != - known_grids.end()); + + LLGridManager::getInstance()->setGridChoice("altgrid.long.name"); + ensure_equals("getGridLabel", + LLGridManager::getInstance()->getGridLabel(), + std::string("Alternative Grid")); + ensure_equals("getGridId", + LLGridManager::getInstance()->getGridId(), + std::string("AltGrid")); + ensure("alternative grid is not a system grid", + !LLGridManager::getInstance()->isSystemGrid()); + ensure("alternative grid is not a production grid", + !LLGridManager::getInstance()->isInProductionGrid()); } + } diff --git a/indra/newview/tests/llviewershadermgr_stub.cpp b/indra/newview/tests/llviewershadermgr_stub.cpp index 18eff72f3c..18eff72f3c 100644..100755 --- a/indra/newview/tests/llviewershadermgr_stub.cpp +++ b/indra/newview/tests/llviewershadermgr_stub.cpp diff --git a/indra/newview/tests/llviewertexture_stub.cpp b/indra/newview/tests/llviewertexture_stub.cpp new file mode 100644 index 0000000000..889ab9bea5 --- /dev/null +++ b/indra/newview/tests/llviewertexture_stub.cpp @@ -0,0 +1,34 @@ +/** + * @file llviewertexture_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2012&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "../llviewertexture.h" +#include "../../llrender/llgltexture.h" + +void LLViewerTexture::setBoostLevel(int level) +{ +} + diff --git a/indra/newview/tests/llwlanimator_stub.cpp b/indra/newview/tests/llwlanimator_stub.cpp index f5e15b2e7b..f5e15b2e7b 100644..100755 --- a/indra/newview/tests/llwlanimator_stub.cpp +++ b/indra/newview/tests/llwlanimator_stub.cpp diff --git a/indra/newview/tests/llwldaycycle_stub.cpp b/indra/newview/tests/llwldaycycle_stub.cpp index a7bc9a7b83..a7bc9a7b83 100644..100755 --- a/indra/newview/tests/llwldaycycle_stub.cpp +++ b/indra/newview/tests/llwldaycycle_stub.cpp diff --git a/indra/newview/tests/llwlparammanager_test.cpp b/indra/newview/tests/llwlparammanager_test.cpp index be0dc9fd0c..be0dc9fd0c 100644..100755 --- a/indra/newview/tests/llwlparammanager_test.cpp +++ b/indra/newview/tests/llwlparammanager_test.cpp diff --git a/indra/newview/tests/llwlparamset_stub.cpp b/indra/newview/tests/llwlparamset_stub.cpp index ccb99db475..ccb99db475 100644..100755 --- a/indra/newview/tests/llwlparamset_stub.cpp +++ b/indra/newview/tests/llwlparamset_stub.cpp diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp index acc6e814bc..84194adb5d 100644..100755 --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -47,9 +47,9 @@ // * A simulator for a class can be implemented here. Please comment and document thoroughly. // Stub image calls -void LLViewerTexture::setBoostLevel(S32 ) { } -void LLViewerTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, BOOL, LLViewerTexture::EBoostLevel, S8, +void LLGLTexture::setBoostLevel(S32 ) { } +void LLGLTexture::setAddressMode(LLTexUnit::eTextureAddressMode ) { } +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture(const LLUUID&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, LLHost ) { return NULL; } // Stub related map calls diff --git a/indra/newview/tests/llworldmipmap_test.cpp b/indra/newview/tests/llworldmipmap_test.cpp index e7ef017760..142d75bcfd 100644..100755 --- a/indra/newview/tests/llworldmipmap_test.cpp +++ b/indra/newview/tests/llworldmipmap_test.cpp @@ -42,8 +42,8 @@ // * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code) // * A simulator for a class can be implemented here. Please comment and document thoroughly. -void LLViewerTexture::setBoostLevel(S32 ) { } -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, BOOL, LLViewerTexture::EBoostLevel, S8, +void LLGLTexture::setBoostLevel(S32 ) { } +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string&, FTType, BOOL, LLGLTexture::EBoostLevel, S8, LLGLint, LLGLenum, const LLUUID& ) { return NULL; } LLControlGroup::LLControlGroup(const std::string& name) : LLInstanceTracker<LLControlGroup, std::string>(name) { } diff --git a/indra/newview/tests/llxmlrpclistener_test.cpp b/indra/newview/tests/llxmlrpclistener_test.cpp index 711c2a3d51..20f913b670 100644..100755 --- a/indra/newview/tests/llxmlrpclistener_test.cpp +++ b/indra/newview/tests/llxmlrpclistener_test.cpp @@ -62,8 +62,8 @@ namespace tut // These variables are required by machinery used by // LLXMLRPCTransaction. The values reflect reality for this test // executable; hopefully these values are correct. - gSavedSettings.declareBOOL("BrowserProxyEnabled", FALSE, "", FALSE); // don't persist - gSavedSettings.declareBOOL("NoVerifySSLCert", TRUE, "", FALSE); // don't persist + gSavedSettings.declareBOOL("BrowserProxyEnabled", FALSE, "", LLControlVariable::PERSIST_NO); // don't persist + gSavedSettings.declareBOOL("NoVerifySSLCert", TRUE, "", LLControlVariable::PERSIST_NO); // don't persist } // LLEventPump listener signature diff --git a/indra/newview/tests/test_llxmlrpc_peer.py b/indra/newview/tests/test_llxmlrpc_peer.py index 281b72a058..281b72a058 100644..100755 --- a/indra/newview/tests/test_llxmlrpc_peer.py +++ b/indra/newview/tests/test_llxmlrpc_peer.py |