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

Unified Diff: google_apis/gcm/engine/connection_factory_impl_unittest.cc

Issue 2628733004: Update ConnectionEventTracker to check if there is an in progress attempt. (Closed)
Patch Set: Rebase and fix nits Created 3 years, 11 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 | « google_apis/gcm/engine/connection_factory_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/engine/connection_factory_impl_unittest.cc
diff --git a/google_apis/gcm/engine/connection_factory_impl_unittest.cc b/google_apis/gcm/engine/connection_factory_impl_unittest.cc
index 3d0f52b3e7725b9610dca0ded9056af9d9e7979a..ed91e4b47b759cb3a5e4ba7c45e0ee7b1ff2e920 100644
--- a/google_apis/gcm/engine/connection_factory_impl_unittest.cc
+++ b/google_apis/gcm/engine/connection_factory_impl_unittest.cc
@@ -602,7 +602,7 @@ TEST_F(ConnectionFactoryImplTest, MultipleFailuresWrapClientEvents) {
// There should be one failed client event for each failed connection, but
// there is a maximum cap of kMaxClientEvents, which is 30. There should also
// be a single event which records the events which were discarded.
- const auto client_events = GetClientEvents();
+ auto client_events = GetClientEvents();
ASSERT_EQ(31, client_events.size());
bool found_discarded_events = false;
@@ -626,8 +626,21 @@ TEST_F(ConnectionFactoryImplTest, MultipleFailuresWrapClientEvents) {
EXPECT_TRUE(connected_server().is_valid());
// Old client events should have been reset after the successful connection.
- const auto new_client_events = GetClientEvents();
- ASSERT_EQ(0, new_client_events.size());
+ client_events = GetClientEvents();
+ ASSERT_EQ(0, client_events.size());
+
+ // Test that EndConnectionAttempt doesn't write empty events to the tracker.
+ // There should be 2 events: 1) the successful connection which was previously
+ // established. 2) the unsuccessful connection triggered as a result of the
+ // SOCKET_FAILURE signal. The NETWORK_CHANGE signal should not cause an
+ // additional event since there is no in progress event.
+ factory()->SetConnectResult(net::ERR_CONNECTION_FAILED);
+ factory()->SignalConnectionReset(ConnectionFactory::SOCKET_FAILURE);
+ factory()->SignalConnectionReset(ConnectionFactory::NETWORK_CHANGE);
+ WaitForConnections();
+
+ client_events = GetClientEvents();
+ ASSERT_EQ(2, client_events.size());
}
} // namespace gcm
« no previous file with comments | « google_apis/gcm/engine/connection_factory_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698