diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-16 22:27:24 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-16 22:27:24 +0000 |
commit | 3d613993d6ec118f49eb07b6b30901ca848cd5f8 (patch) | |
tree | de0cc37500838553663e9e1ffed4887b610d1197 /jingle | |
parent | 761315b2355f5d9a31e1ac73966f5c083f8de09a (diff) | |
download | chromium_src-3d613993d6ec118f49eb07b6b30901ca848cd5f8.zip chromium_src-3d613993d6ec118f49eb07b6b30901ca848cd5f8.tar.gz chromium_src-3d613993d6ec118f49eb07b6b30901ca848cd5f8.tar.bz2 |
Removed TalkMediator SSL initialization.
Since we're now using chrome sockets, we don't need this code.
BUG=54146
TEST=Unit tests
Review URL: http://codereview.chromium.org/3411012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59741 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/notifier/listener/talk_mediator_impl.cc | 46 | ||||
-rw-r--r-- | jingle/notifier/listener/talk_mediator_impl.h | 8 | ||||
-rw-r--r-- | jingle/notifier/listener/talk_mediator_unittest.cc | 18 |
3 files changed, 4 insertions, 68 deletions
diff --git a/jingle/notifier/listener/talk_mediator_impl.cc b/jingle/notifier/listener/talk_mediator_impl.cc index 3276778..3f855a0 100644 --- a/jingle/notifier/listener/talk_mediator_impl.cc +++ b/jingle/notifier/listener/talk_mediator_impl.cc @@ -5,55 +5,19 @@ #include "jingle/notifier/listener/talk_mediator_impl.h" #include "base/logging.h" -#include "base/singleton.h" #include "jingle/notifier/listener/mediator_thread_impl.h" #include "talk/base/cryptstring.h" -#include "talk/base/ssladapter.h" #include "talk/xmpp/xmppclientsettings.h" #include "talk/xmpp/xmppengine.h" namespace notifier { -// Before any authorization event from TalkMediatorImpl, we need to initialize -// the SSL library. -class SslInitializationSingleton { - public: - virtual ~SslInitializationSingleton() { - talk_base::CleanupSSL(); - }; - - void RegisterClient() {} - - static SslInitializationSingleton* GetInstance() { - return Singleton<SslInitializationSingleton>::get(); - } - - private: - friend struct DefaultSingletonTraits<SslInitializationSingleton>; - - SslInitializationSingleton() { - talk_base::InitializeSSL(); - }; - - DISALLOW_COPY_AND_ASSIGN(SslInitializationSingleton); -}; - TalkMediatorImpl::TalkMediatorImpl( - MediatorThread* mediator_thread, - bool initialize_ssl, - bool connect_immediately, - bool invalidate_xmpp_auth_token) + MediatorThread* mediator_thread, bool invalidate_xmpp_auth_token) : delegate_(NULL), mediator_thread_(mediator_thread), invalidate_xmpp_auth_token_(invalidate_xmpp_auth_token) { DCHECK(non_thread_safe_.CalledOnValidThread()); - if (initialize_ssl) { - SslInitializationSingleton::GetInstance()->RegisterClient(); - } - if (connect_immediately) { - mediator_thread_->SetDelegate(this); - state_.connected = 1; - } mediator_thread_->Start(); state_.started = 1; } @@ -68,10 +32,7 @@ TalkMediatorImpl::~TalkMediatorImpl() { bool TalkMediatorImpl::Login() { DCHECK(non_thread_safe_.CalledOnValidThread()); // Connect to the mediator thread and start processing messages. - if (!state_.connected) { - mediator_thread_->SetDelegate(this); - state_.connected = 1; - } + mediator_thread_->SetDelegate(this); if (state_.initialized && !state_.logging_in && !state_.logged_in) { state_.logging_in = true; mediator_thread_->Login(xmpp_settings_); @@ -82,9 +43,6 @@ bool TalkMediatorImpl::Login() { bool TalkMediatorImpl::Logout() { DCHECK(non_thread_safe_.CalledOnValidThread()); - if (state_.connected) { - state_.connected = 0; - } if (state_.started) { state_.started = 0; state_.logging_in = 0; diff --git a/jingle/notifier/listener/talk_mediator_impl.h b/jingle/notifier/listener/talk_mediator_impl.h index d323faa..c439686 100644 --- a/jingle/notifier/listener/talk_mediator_impl.h +++ b/jingle/notifier/listener/talk_mediator_impl.h @@ -27,10 +27,7 @@ class TalkMediatorImpl public: // Takes ownership of |mediator_thread|. TalkMediatorImpl( - MediatorThread* mediator_thread, - bool initialize_ssl, - bool connect_immediately, - bool invalidate_xmpp_auth_token); + MediatorThread* mediator_thread, bool invalidate_xmpp_auth_token); virtual ~TalkMediatorImpl(); // TalkMediator implementation. @@ -61,12 +58,11 @@ class TalkMediatorImpl private: struct TalkMediatorState { TalkMediatorState() - : started(0), connected(0), initialized(0), logging_in(0), + : started(0), initialized(0), logging_in(0), logged_in(0), subscribed(0) { } unsigned int started : 1; // Background thread has started. - unsigned int connected : 1; // Connected to the mediator thread signal. unsigned int initialized : 1; // Initialized with login information. unsigned int logging_in : 1; // Logging in to the mediator's // authenticator. diff --git a/jingle/notifier/listener/talk_mediator_unittest.cc b/jingle/notifier/listener/talk_mediator_unittest.cc index 36bc94b..e00539d 100644 --- a/jingle/notifier/listener/talk_mediator_unittest.cc +++ b/jingle/notifier/listener/talk_mediator_unittest.cc @@ -38,23 +38,10 @@ class TalkMediatorImplTest : public testing::Test { TalkMediatorImplTest() {} virtual ~TalkMediatorImplTest() {} - TalkMediatorImpl* NewTalkMediator() { - const notifier::NotifierOptions kNotifierOptions; - const bool kInitializeSsl = true; - const bool kConnectImmediately = false; - const bool kInvalidateXmppAuthToken = false; - return new TalkMediatorImpl( - new MediatorThreadImpl(kNotifierOptions), kInitializeSsl, - kConnectImmediately, kInvalidateXmppAuthToken); - } - TalkMediatorImpl* NewMockedTalkMediator( MockMediatorThread* mock_mediator_thread) { - const bool kInitializeSsl = false; - const bool kConnectImmediately = true; const bool kInvalidateXmppAuthToken = false; return new TalkMediatorImpl(mock_mediator_thread, - kInitializeSsl, kConnectImmediately, kInvalidateXmppAuthToken); } @@ -67,11 +54,6 @@ class TalkMediatorImplTest : public testing::Test { DISALLOW_COPY_AND_ASSIGN(TalkMediatorImplTest); }; -TEST_F(TalkMediatorImplTest, ConstructionOfTheClass) { - // Constructing a single talk mediator enables SSL through the singleton. - scoped_ptr<TalkMediatorImpl> talk1(NewTalkMediator()); -} - TEST_F(TalkMediatorImplTest, SetAuthTokenWithBadInput) { scoped_ptr<TalkMediatorImpl> talk1( NewMockedTalkMediator(new MockMediatorThread())); |