diff options
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/notifier/communicator/single_login_attempt.cc | 1 | ||||
-rw-r--r-- | jingle/notifier/listener/push_client.cc | 7 | ||||
-rw-r--r-- | jingle/notifier/listener/push_client.h | 6 | ||||
-rw-r--r-- | jingle/notifier/listener/push_client_unittest.cc | 11 |
4 files changed, 23 insertions, 2 deletions
diff --git a/jingle/notifier/communicator/single_login_attempt.cc b/jingle/notifier/communicator/single_login_attempt.cc index b4cae89..0c789ee 100644 --- a/jingle/notifier/communicator/single_login_attempt.cc +++ b/jingle/notifier/communicator/single_login_attempt.cc @@ -41,6 +41,7 @@ SingleLoginAttempt::~SingleLoginAttempt() {} void SingleLoginAttempt::OnConnect( base::WeakPtr<buzz::XmppTaskParentInterface> base_task) { + DVLOG(1) << "Connected to " << current_settings_->ToString(); delegate_->OnConnect(base_task); } diff --git a/jingle/notifier/listener/push_client.cc b/jingle/notifier/listener/push_client.cc index d704264..f96e8f8 100644 --- a/jingle/notifier/listener/push_client.cc +++ b/jingle/notifier/listener/push_client.cc @@ -31,4 +31,11 @@ scoped_ptr<PushClient> PushClient::CreateDefault( base::Bind(&CreateXmppPushClient, notifier_options))); } +scoped_ptr<PushClient> PushClient::CreateDefaultOnIOThread( + const NotifierOptions& notifier_options) { + CHECK(notifier_options.request_context_getter->GetIOMessageLoopProxy()-> + BelongsToCurrentThread()); + return CreateXmppPushClient(notifier_options); +} + } // namespace notifier diff --git a/jingle/notifier/listener/push_client.h b/jingle/notifier/listener/push_client.h index ea975a8..f80f422 100644 --- a/jingle/notifier/listener/push_client.h +++ b/jingle/notifier/listener/push_client.h @@ -27,6 +27,12 @@ class PushClient { static scoped_ptr<PushClient> CreateDefault( const NotifierOptions& notifier_options); + // Creates a default blocking PushClient implementation from the + // given options. Must be called from the IO thread (according to + // |notifier_options|). + static scoped_ptr<PushClient> CreateDefaultOnIOThread( + const NotifierOptions& notifier_options); + // Manage the list of observers for incoming notifications. virtual void AddObserver(PushClientObserver* observer) = 0; virtual void RemoveObserver(PushClientObserver* observer) = 0; diff --git a/jingle/notifier/listener/push_client_unittest.cc b/jingle/notifier/listener/push_client_unittest.cc index fd45466..42daf2a 100644 --- a/jingle/notifier/listener/push_client_unittest.cc +++ b/jingle/notifier/listener/push_client_unittest.cc @@ -33,13 +33,13 @@ class PushClientTest : public testing::Test { }; // Make sure calling CreateDefault on the IO thread doesn't blow up. -TEST_F(PushClientTest, OnIOThread) { +TEST_F(PushClientTest, CreateDefaultOnIOThread) { const scoped_ptr<PushClient> push_client( PushClient::CreateDefault(notifier_options_)); } // Make sure calling CreateDefault on a non-IO thread doesn't blow up. -TEST_F(PushClientTest, OffIOThread) { +TEST_F(PushClientTest, CreateDefaultOffIOThread) { base::Thread thread("Non-IO thread"); EXPECT_TRUE(thread.Start()); thread.message_loop()->PostTask( @@ -49,6 +49,13 @@ TEST_F(PushClientTest, OffIOThread) { thread.Stop(); } +// Make sure calling CreateDefaultOnIOThread on the IO thread doesn't +// blow up. +TEST_F(PushClientTest, CreateDefaultOnIOThreadOnIOThread) { + const scoped_ptr<PushClient> push_client( + PushClient::CreateDefaultOnIOThread(notifier_options_)); +} + } // namespace } // namespace notifier |