Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Unified Diff: jingle/notifier/listener/talk_mediator_unittest.cc

Issue 6881042: [Sync] Fix race condition in P2PNotifier with sending notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « jingle/notifier/listener/talk_mediator_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: jingle/notifier/listener/talk_mediator_unittest.cc
diff --git a/jingle/notifier/listener/talk_mediator_unittest.cc b/jingle/notifier/listener/talk_mediator_unittest.cc
index 7b93d6427a8bdf48c16b9c8ff830255bc088346f..c72e0e9c489918b0fd9d774513f07bb9692561c0 100644
--- a/jingle/notifier/listener/talk_mediator_unittest.cc
+++ b/jingle/notifier/listener/talk_mediator_unittest.cc
@@ -110,29 +110,25 @@ TEST_F(TalkMediatorImplTest, SendNotification) {
MockMediatorThread* mock = new MockMediatorThread();
scoped_ptr<TalkMediatorImpl> talk1(NewMockedTalkMediator(mock));
- // Failure due to not being logged in.
Notification data;
- EXPECT_FALSE(talk1->SendNotification(data));
- EXPECT_EQ(0, mock->send_calls);
+ talk1->SendNotification(data);
+ EXPECT_EQ(1, mock->send_calls);
talk1->SetAuthToken("chromium@gmail.com", "token", "fake_service");
EXPECT_TRUE(talk1->Login());
talk1->OnConnectionStateChange(true);
EXPECT_EQ(1, mock->login_calls);
- // Should be subscribed now.
- EXPECT_TRUE(talk1->state_.subscribed);
- EXPECT_TRUE(talk1->SendNotification(data));
- EXPECT_EQ(1, mock->send_calls);
- EXPECT_TRUE(talk1->SendNotification(data));
+ talk1->SendNotification(data);
EXPECT_EQ(2, mock->send_calls);
+ talk1->SendNotification(data);
+ EXPECT_EQ(3, mock->send_calls);
EXPECT_TRUE(talk1->Logout());
EXPECT_EQ(1, mock->logout_calls);
- // Failure due to being logged out.
- EXPECT_FALSE(talk1->SendNotification(data));
- EXPECT_EQ(2, mock->send_calls);
+ talk1->SendNotification(data);
+ EXPECT_EQ(4, mock->send_calls);
}
TEST_F(TalkMediatorImplTest, MediatorThreadCallbacks) {
@@ -154,12 +150,11 @@ TEST_F(TalkMediatorImplTest, MediatorThreadCallbacks) {
// The message triggers calls to listen and subscribe.
EXPECT_EQ(1, mock->listen_calls);
EXPECT_EQ(1, mock->subscribe_calls);
- EXPECT_TRUE(talk1->state_.subscribed);
// After subscription success is receieved, the talk mediator will allow
// sending of notifications.
Notification outgoing_data;
- EXPECT_TRUE(talk1->SendNotification(outgoing_data));
+ talk1->SendNotification(outgoing_data);
EXPECT_EQ(1, mock->send_calls);
Notification incoming_data;
« no previous file with comments | « jingle/notifier/listener/talk_mediator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698