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

Side by Side 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: Added ConnectionEventTracker to manage all the events. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "google_apis/gcm/engine/connection_event_tracker.h"
6
7 #include "google_apis/gcm/protocol/mcs.pb.h"
8 #include "net/base/net_errors.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace gcm {
Peter Beverloo 2016/12/02 15:19:13 micro nit: wrap in an inner anonymous namespace
harkness 2016/12/05 15:39:00 Done.
12
13 class ConnectionEventTrackerTest : public testing::Test {
14 public:
15 ConnectionEventTrackerTest() {}
Peter Beverloo 2016/12/02 15:19:13 nit: I think you can just delete the constructor.
harkness 2016/12/05 15:39:00 Done.
16
17 ConnectionEventTracker* tracker() { return &tracker_; }
18
19 private:
20 ConnectionEventTracker tracker_;
21 };
22
23 TEST_F(ConnectionEventTrackerTest, SuccessfulAttempt) {
harkness 2016/12/01 10:34:34 I'm planning to add more tests to this when I add
24 tracker()->StartConnectionAttempt();
25 tracker()->ConnectionAttemptSucceeded();
26 tracker()->EndConnectionAttempt();
27
28 mcs_proto::LoginRequest request;
29 tracker()->WriteToLoginRequest(&request);
30
31 ASSERT_EQ(request.client_event().size(), 1);
32 for (const auto& event : request.client_event())
33 EXPECT_EQ(event.type(), mcs_proto::ClientEvent::SUCCESSFUL_CONNECTION);
34 }
35
36 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698