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

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

Issue 2481873002: Added ClientEvent proto and structure for storing events in the factory. (Closed)
Patch Set: Integrated code review comments Created 4 years 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
Index: google_apis/gcm/engine/connection_event_tracker_unittest.cc
diff --git a/google_apis/gcm/engine/connection_event_tracker_unittest.cc b/google_apis/gcm/engine/connection_event_tracker_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c1a64d85833912995dcddedf95ccd7abc32f2011
--- /dev/null
+++ b/google_apis/gcm/engine/connection_event_tracker_unittest.cc
@@ -0,0 +1,37 @@
+// Copyright 2016 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.
+
+#include "google_apis/gcm/engine/connection_event_tracker.h"
+
+#include "google_apis/gcm/protocol/mcs.pb.h"
+#include "net/base/net_errors.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace gcm {
+namespace {
+
+class ConnectionEventTrackerTest : public testing::Test {
+ public:
+ ConnectionEventTracker* tracker() { return &tracker_; }
+
+ private:
+ ConnectionEventTracker tracker_;
+};
+
+} // namespace
+
+TEST_F(ConnectionEventTrackerTest, SuccessfulAttempt) {
+ tracker()->StartConnectionAttempt();
+ tracker()->ConnectionAttemptSucceeded();
+ tracker()->EndConnectionAttempt();
+
+ mcs_proto::LoginRequest request;
+ tracker()->WriteToLoginRequest(&request);
+
+ ASSERT_EQ(request.client_event().size(), 1);
+ for (const auto& event : request.client_event())
+ EXPECT_EQ(event.type(), mcs_proto::ClientEvent::SUCCESSFUL_CONNECTION);
+}
+
+} // namespace gcm
« no previous file with comments | « google_apis/gcm/engine/connection_event_tracker.cc ('k') | google_apis/gcm/engine/connection_factory_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698