diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2015-01-23 04:09:17 -0800 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2015-01-23 04:09:17 -0800 |
commit | c93648e3d2a5a70a6fc8c0de46d45580798b0386 (patch) | |
tree | a594de399fc7bb290762c942eec2b5ce88243359 /indra/newview/lllogininstance.cpp | |
parent | ba43a216fdd1ee5f77f3aece4ce9dbf441bab3e6 (diff) |
Make MandatoryUpdateMachine use LLLoginInstance's LLNotificationsInterface.
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.
Diffstat (limited to 'indra/newview/lllogininstance.cpp')
-rwxr-xr-x | indra/newview/lllogininstance.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 03ef11d8e5..b4d0bb6823 100755 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -58,7 +58,6 @@ #include "llmachineid.h" #include "llupdaterservice.h" #include "llevents.h" -#include "llnotificationsutil.h" #include "llappviewer.h" #include <boost/scoped_ptr.hpp> @@ -75,9 +74,14 @@ namespace { { public: MandatoryUpdateMachine(LLLoginInstance & loginInstance, LLUpdaterService & updaterService); - + void start(void); - + + LLNotificationsInterface& getNotificationsInterface() const + { + return mLoginInstance.getNotificationsInterface(); + } + private: class State; class CheckingForUpdate; @@ -87,6 +91,7 @@ namespace { class WaitingForDownload; boost::scoped_ptr<State> mState; + LLLoginInstance & mLoginInstance; LLUpdaterService & mUpdaterService; void setCurrentState(State * newState); @@ -192,6 +197,7 @@ std::string construct_start_string(); MandatoryUpdateMachine::MandatoryUpdateMachine(LLLoginInstance & loginInstance, LLUpdaterService & updaterService): + mLoginInstance(loginInstance), mUpdaterService(updaterService) { ; // No op. @@ -326,7 +332,7 @@ MandatoryUpdateMachine::Error::Error(MandatoryUpdateMachine & machine): void MandatoryUpdateMachine::Error::enter(void) { LL_INFOS() << "entering error" << LL_ENDL; - LLNotificationsUtil::add("FailedRequiredUpdateInstall", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::Error::onButtonClicked, this, _1, _2)); + mMachine.getNotificationsInterface().add("FailedRequiredUpdateInstall", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::Error::onButtonClicked, this, _1, _2)); } @@ -382,7 +388,7 @@ MandatoryUpdateMachine::StartingUpdaterService::StartingUpdaterService(Mandatory void MandatoryUpdateMachine::StartingUpdaterService::enter(void) { LL_INFOS() << "entering start update service" << LL_ENDL; - LLNotificationsUtil::add("UpdaterServiceNotRunning", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::StartingUpdaterService::onButtonClicked, this, _1, _2)); + mMachine.getNotificationsInterface().add("UpdaterServiceNotRunning", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::StartingUpdaterService::onButtonClicked, this, _1, _2)); } |