| OLD | NEW |
| (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 { |
| 12 namespace { |
| 13 |
| 14 class ConnectionEventTrackerTest : public testing::Test { |
| 15 public: |
| 16 ConnectionEventTracker* tracker() { return &tracker_; } |
| 17 |
| 18 private: |
| 19 ConnectionEventTracker tracker_; |
| 20 }; |
| 21 |
| 22 } // namespace |
| 23 |
| 24 TEST_F(ConnectionEventTrackerTest, SuccessfulAttempt) { |
| 25 tracker()->StartConnectionAttempt(); |
| 26 tracker()->ConnectionAttemptSucceeded(); |
| 27 tracker()->EndConnectionAttempt(); |
| 28 |
| 29 mcs_proto::LoginRequest request; |
| 30 tracker()->WriteToLoginRequest(&request); |
| 31 |
| 32 ASSERT_EQ(request.client_event().size(), 1); |
| 33 for (const auto& event : request.client_event()) |
| 34 EXPECT_EQ(event.type(), mcs_proto::ClientEvent::SUCCESSFUL_CONNECTION); |
| 35 } |
| 36 |
| 37 } // namespace gcm |
| OLD | NEW |