Index: chrome/browser/sync/notifier/sync_notifier_factory_unittest.cc |
diff --git a/chrome/browser/sync/notifier/sync_notifier_factory_unittest.cc b/chrome/browser/sync/notifier/sync_notifier_factory_unittest.cc |
index 63ece7068865aa5431a51f7f3431f740f9c0cac5..70783a55013442230523f3473f88b828a7b9e085 100644 |
--- a/chrome/browser/sync/notifier/sync_notifier_factory_unittest.cc |
+++ b/chrome/browser/sync/notifier/sync_notifier_factory_unittest.cc |
@@ -16,12 +16,8 @@ |
#include "chrome/browser/sync/notifier/sync_notifier.h" |
#include "chrome/browser/sync/syncable/model_type.h" |
#include "chrome/browser/sync/syncable/model_type_payload_map.h" |
-#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/chrome_switches.h" |
-#include "chrome/test/base/profile_mock.h" |
#include "chrome/test/base/test_url_request_context_getter.h" |
-#include "content/public/browser/notification_service.h" |
-#include "content/public/browser/notification_details.h" |
#include "content/test/test_browser_thread.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -35,19 +31,16 @@ using ::testing::StrictMock; |
using content::BrowserThread; |
class SyncNotifierFactoryTest : public testing::Test { |
- public: |
- // TODO(zea): switch to using real io_thread instead of shared message loop. |
+ protected: |
SyncNotifierFactoryTest() |
: ui_thread_(BrowserThread::UI, &message_loop_), |
io_thread_(BrowserThread::IO, &message_loop_), |
command_line_(CommandLine::NO_PROGRAM) {} |
virtual ~SyncNotifierFactoryTest() {} |
- protected: |
virtual void SetUp() OVERRIDE { |
request_context_getter_ = new TestURLRequestContextGetter; |
factory_.reset(new SyncNotifierFactory( |
- &mock_profile_, |
"fake_client_info", |
request_context_getter_, |
base::WeakPtr<sync_notifier::InvalidationVersionTracker>(), |
@@ -56,25 +49,15 @@ class SyncNotifierFactoryTest : public testing::Test { |
} |
virtual void TearDown() OVERRIDE { |
- Mock::VerifyAndClearExpectations(&mock_profile_); |
Mock::VerifyAndClearExpectations(&mock_observer_); |
request_context_getter_ = NULL; |
message_loop_.RunAllPending(); |
command_line_ = CommandLine(CommandLine::NO_PROGRAM); |
} |
- void TriggerRefreshNotification() { |
- const syncable::ModelType type = syncable::SESSIONS; |
- content::NotificationService::current()->Notify( |
- chrome::NOTIFICATION_SYNC_REFRESH, |
- content::Source<Profile>(&mock_profile_), |
- content::Details<const syncable::ModelType>(&type)); |
- } |
- |
MessageLoop message_loop_; |
content::TestBrowserThread ui_thread_; |
content::TestBrowserThread io_thread_; |
- NiceMock<ProfileMock> mock_profile_; |
scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
StrictMock<MockSyncNotifierObserver> mock_observer_; |
scoped_ptr<SyncNotifierFactory> factory_; |
@@ -98,43 +81,5 @@ TEST_F(SyncNotifierFactoryTest, Basic_P2P) { |
notifier->RemoveObserver(&mock_observer_); |
} |
-// Create a default sync notifier (NonBlockingInvalidationNotifier wrapped by a |
-// BridgedSyncNotifier) and then trigger a sync refresh notification. The |
akalin
2012/02/29 02:19:52
Not sure if there's a good place to put these test
|
-// observer should receive the notification as a LOCAL_NOTIFICATION. |
-TEST_F(SyncNotifierFactoryTest, ChromeSyncNotification) { |
- syncable::ModelTypePayloadMap type_payloads; |
- type_payloads[syncable::SESSIONS] = ""; |
- EXPECT_CALL(mock_observer_, |
- OnIncomingNotification(type_payloads, |
- LOCAL_NOTIFICATION)); |
- |
- scoped_ptr<SyncNotifier> notifier(factory_->CreateSyncNotifier()); |
- ASSERT_TRUE(notifier.get()); |
- notifier->AddObserver(&mock_observer_); |
- TriggerRefreshNotification(); |
- message_loop_.RunAllPending(); |
- notifier->RemoveObserver(&mock_observer_); |
-} |
- |
- |
-// Create a P2P sync notifier (wrapped by a BridgedSyncNotifier) |
-// and then trigger a sync refresh notification. The observer should receive |
-// the notification as a LOCAL_NOTIFICATION. |
-TEST_F(SyncNotifierFactoryTest, ChromeSyncNotification_P2P) { |
- syncable::ModelTypePayloadMap type_payloads; |
- type_payloads[syncable::SESSIONS] = ""; |
- EXPECT_CALL(mock_observer_, |
- OnIncomingNotification(type_payloads, |
- LOCAL_NOTIFICATION)); |
- |
- command_line_.AppendSwitchASCII(switches::kSyncNotificationMethod, "p2p"); |
- scoped_ptr<SyncNotifier> notifier(factory_->CreateSyncNotifier()); |
- ASSERT_TRUE(notifier.get()); |
- notifier->AddObserver(&mock_observer_); |
- TriggerRefreshNotification(); |
- message_loop_.RunAllPending(); |
- notifier->RemoveObserver(&mock_observer_); |
-} |
- |
} // namespace |
} // namespace sync_notifier |