summaryrefslogtreecommitdiff
path: root/indra/newview/tests/lllogininstance_test.cpp
AgeCommit message (Collapse)Author
2020-03-25SL-11216: Convert LLVersionInfo to an LLSingleton.Nat Goodspeed
This changeset is meant to exemplify how to convert a "namespace" class whose methods are static -- and whose data are module-static -- to an LLSingleton. LLVersionInfo has no initClass() or cleanupClass() methods, but the general idea is the same. * Derive the class from LLSingleton<T>: class LLSomeSingleton: public LLSingleton<LLSomeSingleton> { ... }; * Add LLSINGLETON(LLSomeSingleton); in the private section of the class. This usage implies a separate LLSomeSingleton::LLSomeSingleton() definition, as described in indra/llcommon/llsingleton.h. * Move module-scope data in the .cpp file to non-static class members. Change any sVariableName to mVariableName to avoid being outright misleading. * Make static class methods non-static. Remove '//static' comments from method definitions as needed. * For LLVersionInfo specifically, the 'const std::string&' return type was replaced with 'std::string'. Returning a reference to a static or a member, const or otherwise, is an anti-pattern: the interface constrains the implementation, prohibiting possibly later returning a temporary (an expression). * For LLVersionInfo specifically, 'const S32' return type was replaced with simple 'S32'. 'const' is just noise in that usage. * Simple member initialization (e.g. the original initializer expressions for static variables) can be done with member{ value } initializers (no examples here though). * Delete initClass() method. * LLSingleton's forté is of course lazy initialization. It might work to simply delete any calls to initClass(). But if there are side effects that must happen at that moment, replace LLSomeSingleton::initClass() with (void)LLSomeSingleton::instance(); * Most initClass() initialization can be done in the constructor, as would normally be the case. * Initialization that might cause a circular LLSingleton reference should be moved to initSingleton(). Override 'void initSingleton();' should be private. * For LLVersionInfo specifically, certain initialization that used to be lazily performed was made unconditional, due to its low cost. * For LLVersionInfo specifically, certain initialization involved calling methods that have become non-static. This was moved to initSingleton() because, in a constructor body, 'this' does not yet point to the enclosing class. * Delete cleanupClass() method. * There is already a generic LLSingletonBase::deleteAll() call in LLAppViewer::cleanup(). It might work to let this new LLSingleton be cleaned up with all the rest. But if there are side effects that must happen at that moment, replace LLSomeSingleton::cleanupClass() with LLSomeSingleton::deleteSingleton(). That said, much of the benefit of converting to LLSingleton is deleteAll()'s guarantee that cross-LLSingleton dependencies will be properly honored: we're trying to migrate the code base away from the present fragile manual cleanup sequence. * Most cleanupClass() cleanup can be done in the destructor, as would normally be the case. * Cleanup that might throw an exception should be moved to cleanupSingleton(). Override 'void cleanupSingleton();' should be private. * Within LLSomeSingleton methods, remove any existing LLSomeSingleton::methodName() qualification: simple methodName() is better. * In the rest of the code base, convert most LLSomeSingleton::methodName() references to LLSomeSingleton::instance().methodName(). (Prefer instance() to getInstance() because a reference does not admit the possibility of NULL.) * Of course, LLSomeSingleton::ENUM_VALUE can remain unchanged. In general, for many successive references to an LLSingleton instance, it can be useful to capture the instance() as in: auto& versionInfo{LLVersionInfo::instance()}; // ... versionInfo.getVersion() ... We did not do that here only to simplify the code review. The STRINGIZE(expression) macro encapsulates: std::ostringstream out; out << expression; return out.str(); We used that in a couple places. For LLVersionInfo specifically, lllogininstance_test.cpp used to dummy out a couple specific static methods. It's harder to dummy out LLSingleton::instance() references, so we add the real class to that test.
2017-08-23merge changes for MAINT-7594Oz Linden
2017-08-22MAINT-7594: add platform name string to login request (and add request ↵Oz Linden
parameter logging at DEBUG)
2017-08-14MAINT-7640: Notify the user if login is blocked for a required viewer updateOz Linden
2017-03-01SL-321: remove redundant const declaration of MD5HEX_STR_SIZE in ↵Glenn Glazer
llversioninfo, remove extraneous python variable assignment in CMakeLists, run tests with INFO
2017-03-01SL-321: fix merge removal of llhasheduniqueid from from llloginstance_test's ↵Glenn Glazer
include path
2017-02-28mergecoyot@coyot-sager-PC
2016-09-14MAINT-6731 Use web profile URLs from the grid configurationNatty Linden
2016-08-22SL-323: ripping out old code completedGlenn Glazer
2016-08-18SL-323: first pass at ripping out old updaterGlenn Glazer
2015-11-10remove execute permission from many files that should not have itOz Linden
2015-01-23Make MandatoryUpdateMachine use LLLoginInstance's LLNotificationsInterface.Nat Goodspeed
LLLoginInstance has a test hook setNotificationsInterface(), used by lllogininstance_test.cpp to redirect notifications through a dummy LLNotificationsInterface implementation. Certain of LLLoginInstance's MandatoryUpdateMachine state classes need to post notifications too; but until now they directly called LLNotificationsUtil::add(). In the production viewer, this should (!) be the same as calling through LLLoginInstance::mNotifications -- but it broke two of the LLLoginInstance unit tests, so they were skipped. Since MandatoryUpdateMachine's constructor is already passed the invoking LLLoginInstance&, make it store the reference. Add MandatoryUpdateMachine:: getNotificationsInterface(), which forwards to new LLLoginInstance:: getNotificationsInterface(). Change LLNotificationsUtil::add() calls in MandatoryUpdateMachine state classes to call through mMachine's getNotificationInterface() instead. This allows us to remove #include "llnotificationsutil.h" from lllogininstance.cpp, also that #include plus stub LLNotificationsUtil::add() implementation from lllogininstance_test.cpp. Finally, it allows us to remove the skip() calls from the two unit tests.
2014-10-23Bring in new TUT library build. Clean up ensure_equals() overloads.Nat Goodspeed
The new TUT library build eliminates the ambiguity about ensure_equals(const char*, ...) versus ensure_equals(const std::string&, ...). Now it's all based on const std::string&. Remove pointless const char* overloads and ambiguous forwarding templates. With clang in Xcode 6, any new datatypes we intend to use with ensure_equals() must have operator<<(std::ostream&, datatype) declared BEFORE lltut.h #includes tut.hpp. Reorder code in certain test source files to guarantee that visibility.
2013-08-07merge changes for DRTVWR-333Oz Linden
2013-07-25CHOP-962: Make LLControlVariable::setPersist() accept only enum.Nat Goodspeed
Initial change made LLControlVariable::mPersist an enum, but retained bool/BOOL public API. setPersist(true) set one value, setPersist(false) set another, forcePersist() set the third. Per code review, expose enum to public, make setPersist() (and LLControlVariable constructor, and LLControlGroup:: declareControl(), and all the LLControlGroup::declareMumble() methods, and all the unit-test dummy declareMumble() method bodies) accept that enum. Remove forcePersist(). Fix calls to LLControlGroup::declareMumble() accordingly. Also rename PERSIST_YES to PERSIST_NONDFT, also per code review.
2013-07-17CHOP-962: Make LLControlGroup::declare* return LLControlVariable*Nat Goodspeed
LLControlGroup::declareControl(), declareString() etc. etc. all used to return BOOL -- which no one ever examines because it unconditionally returned TRUE. Make it return the (possibly new) LLControlVariable* instead.
2013-07-09CHOP-963: Make update service query url depend on the grid rather than settingsOz Linden
2013-04-19merge up to latest viewer-development for merge to 3.5.2Oz Linden
2013-03-29Update Mac and Windows breakpad builds to latestGraham Madarasz
2013-03-27change login to pass only the version instead of channel+version in the ↵Oz Linden
version parameter (channel is passed separately)
2013-03-27add platform and platform version to login request parameters for new ↵Oz Linden
version manager query
2013-02-21add use of v1.1 update request protocol, with fallback to v1.0Oz Linden
2012-08-09MAINT-1342: correct initial login location handling, clarify the two related ↵Oz Linden
persistent settings
2012-07-02improve logging of invalid grid definitions, prevent clashes with old viewersOz Linden
2012-06-12PATH-735: Limit and clean up grid selectionOz Linden
2010-12-10ui improvements to more closely match UX design.Andrew A. de Laix
2010-12-08fix windows build.Andrew A. de Laix
2010-12-07show progress bar while downloading update.Andrew A. de Laix
2010-12-07login instance coordinates with updater serviceAndrew A. de Laix
2010-12-01CHOP-238 Fix to bug introduced by ↵Mark Palange (Mani)
http://hg.secondlife.com/viewer-beta/changeset/4072bd5389b2 Reviewed by Brad
2010-11-01VWR-23666 Removed setting VersionChannelName. LLVersionInfo::resetChannel() ↵Mark Palange (Mani)
and unit tests. Reviewed by brad.
2010-09-22mergeRichard Linden
2010-09-22doh, fix this in the RIGHT place.Tofu Linden
2010-09-22CID-505Tofu Linden
Checker: UNINIT_CTOR Function: LLGridManager::LLGridManager() File: /indra/newview/tests/lllogininstance_test.cpp
2010-09-16mergeRichard Linden
2010-09-09fixed link seam in login unit testRichard Linden
2010-08-25standardizing a couple of stragler test 'suite' names as class nameAaron Terrell (Enus)
2010-08-13Change license from GPL to LGPL (version 2.1)Oz Linden
2010-07-23Fixed PROJECT_secondlife-bin_TEST_lllogininstance unit test to fix Linux build.Sergei Litovchuk
--HG-- branch : product-engine
2010-04-22DEV-49332 - cryptic error message when typing in single username when ↵Roxie Linden
logging into maingrid. Needs to be changed when IE is checked in, of course. Now we check the expected credential formats for a given grid against the format that is typed in, and throw an error if it's invalid.
2010-04-07Re-insert backed out SLE checkin so we can fix itRoxie Linden
2010-04-07Backed out changeset 63b699f90efdTofu Linden
2010-02-26automated mergeRoxie Linden
2010-02-25automated mergeRoxie Linden
2010-02-12Changing viewer unit test licenses to viewergplMark Palange (Mani)
2010-01-29CID-319Tofu Linden
Checker: UNINIT_CTOR Function: LLViewerLogin::LLViewerLogin() File: /indra/newview/tests/lllogininstance_test.cpp
2009-11-11Changes to fix an LLERRS caused by SRV request timeout.Mark Palange (Mani)
Added settings to config SRV request params Increased timeout to 10 seconds Changed timeout to generate login failure event instead of an error. Added unit test to cover SRV failure event.
2009-11-03mergeLoren Shih
--HG-- branch : avatar-pipeline
2009-10-09DEV-40930: Added ["change"] key to login-module status events. ChangedNat Goodspeed
existing event calls to use state as "offline" or "online", with "change" indicating the reason for this status event. Changed disconnect() to send state "offline", change "disconnect" -- instead of replaying last auth failure. Changed unit tests accordingly. Changed LLLoginInstance::handleLoginEvent() to use LLEventDispatcher to route calls to handleLoginFailure() et al. Added LLEventDispatcher::get() to allow retrieving Callable by name and testing for empty().
2009-09-11QAR-1619: Remove unneeded llfloatertos.h #includes.Nat Goodspeed
Neither lllogininstance.cpp nor lllogininstance_test.cpp need llfloatertos.h any more, since LLLoginInstance talks to LLFloaterTOS only via LLFloaterReg and LLEventPumps. However, both sources depended on llfloatertos.h dragging in llnotifications.h, so include that explicitly instead of llfloatertos.h.