diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-10 22:14:51 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-10 22:14:51 +0000 |
commit | 582713535d7293b76c8835f5f4f7821361a7d1b5 (patch) | |
tree | 46b716dc43aad82d176ba92a01df8767154c64e5 /jingle/notifier | |
parent | 62e43e2d4624ab293be9f2f673c4b209752c94ba (diff) | |
download | chromium_src-582713535d7293b76c8835f5f4f7821361a7d1b5.zip chromium_src-582713535d7293b76c8835f5f4f7821361a7d1b5.tar.gz chromium_src-582713535d7293b76c8835f5f4f7821361a7d1b5.tar.bz2 |
[Sync] Fixed sync crash regression in ServerNotifierThread
Added unit tests for ServerNotifierThread.
Put DISABLE_RUNNABLE_METHOD_REFCOUNT() call for MediatorThreadImpl in the right place.
BUG=57898
TEST=New unittests
Review URL: http://codereview.chromium.org/5722002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle/notifier')
-rw-r--r-- | jingle/notifier/base/fake_base_task.cc | 6 | ||||
-rw-r--r-- | jingle/notifier/base/fake_base_task.h | 5 | ||||
-rw-r--r-- | jingle/notifier/listener/mediator_thread_impl.cc | 4 | ||||
-rw-r--r-- | jingle/notifier/listener/mediator_thread_impl.h | 4 |
4 files changed, 7 insertions, 12 deletions
diff --git a/jingle/notifier/base/fake_base_task.cc b/jingle/notifier/base/fake_base_task.cc index 255ae64..3777399 100644 --- a/jingle/notifier/base/fake_base_task.cc +++ b/jingle/notifier/base/fake_base_task.cc @@ -1,11 +1,7 @@ // Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// -// A simple wrapper around invalidation::InvalidationClient that -// handles all the startup/shutdown details and hookups. -#include "base/message_loop.h" #include "jingle/notifier/base/fake_base_task.h" #include "jingle/notifier/base/weak_xmpp_client.h" #include "talk/xmpp/asyncsocket.h" @@ -42,7 +38,7 @@ FakeBaseTask::FakeBaseTask() { EXPECT_CALL(*mock_async_socket, Connect(_)).WillOnce(Return(true)); weak_xmpp_client->Connect(settings, "en", mock_async_socket, NULL); // Initialize the XMPP client. - MessageLoop::current()->RunAllPending(); + task_pump_.RunTasks(); base_task_ = weak_xmpp_client->AsWeakPtr(); } diff --git a/jingle/notifier/base/fake_base_task.h b/jingle/notifier/base/fake_base_task.h index c165561..d746432 100644 --- a/jingle/notifier/base/fake_base_task.h +++ b/jingle/notifier/base/fake_base_task.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// A simple wrapper around invalidation::InvalidationClient that -// handles all the startup/shutdown details and hookups. +// A stand-in for stuff that expects a weak pointer to a BaseTask for +// testing. #ifndef JINGLE_NOTIFIER_FAKE_XMPP_CLIENT_H_ #define JINGLE_NOTIFIER_FAKE_XMPP_CLIENT_H_ @@ -19,7 +19,6 @@ class Task; namespace notifier { -// This class expects a message loop to exist on the current thread. class FakeBaseTask { public: FakeBaseTask(); diff --git a/jingle/notifier/listener/mediator_thread_impl.cc b/jingle/notifier/listener/mediator_thread_impl.cc index fb3f709..ca384af 100644 --- a/jingle/notifier/listener/mediator_thread_impl.cc +++ b/jingle/notifier/listener/mediator_thread_impl.cc @@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/message_loop.h" -#include "base/task.h" #include "jingle/notifier/base/task_pump.h" #include "jingle/notifier/communicator/connection_options.h" #include "jingle/notifier/communicator/const_communicator.h" @@ -18,9 +17,6 @@ #include "net/base/host_resolver.h" #include "talk/xmpp/xmppclientsettings.h" -// We manage the lifetime of notifier::MediatorThreadImpl ourselves. -DISABLE_RUNNABLE_METHOD_REFCOUNT(notifier::MediatorThreadImpl); - namespace notifier { MediatorThreadImpl::MediatorThreadImpl(const NotifierOptions& notifier_options) diff --git a/jingle/notifier/listener/mediator_thread_impl.h b/jingle/notifier/listener/mediator_thread_impl.h index a4a1de6..302c183 100644 --- a/jingle/notifier/listener/mediator_thread_impl.h +++ b/jingle/notifier/listener/mediator_thread_impl.h @@ -27,6 +27,7 @@ #include "base/observer_list_threadsafe.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/task.h" #include "base/thread.h" #include "base/weak_ptr.h" #include "jingle/notifier/base/notifier_options.h" @@ -112,4 +113,7 @@ class MediatorThreadImpl : public MediatorThread, public LoginDelegate, } // namespace notifier +// We manage the lifetime of notifier::MediatorThreadImpl ourselves. +DISABLE_RUNNABLE_METHOD_REFCOUNT(notifier::MediatorThreadImpl); + #endif // JINGLE_NOTIFIER_LISTENER_MEDIATOR_THREAD_IMPL_H_ |