OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/gcm_driver/gcm_stats_recorder_impl.h" | 5 #include "components/gcm_driver/gcm_stats_recorder_impl.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <deque> | 9 #include <deque> |
8 #include <string> | 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "google_apis/gcm/engine/mcs_client.h" | 13 #include "google_apis/gcm/engine/mcs_client.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
13 | 15 |
14 namespace gcm { | 16 namespace gcm { |
15 | 17 |
16 namespace { | 18 namespace { |
17 | 19 |
18 static uint64 kAndroidId = 4U; | 20 static uint64_t kAndroidId = 4U; |
19 static const char kCheckinStatus[] = "URL_FETCHING_FAILED"; | 21 static const char kCheckinStatus[] = "URL_FETCHING_FAILED"; |
20 static const char kHost[] = "www.example.com"; | 22 static const char kHost[] = "www.example.com"; |
21 static const char kAppId[] = "app id 1"; | 23 static const char kAppId[] = "app id 1"; |
22 static const char kFrom[] = "from"; | 24 static const char kFrom[] = "from"; |
23 static const char kSenderIds[] = "s1,s2"; | 25 static const char kSenderIds[] = "s1,s2"; |
24 static const char kReceiverId[] = "receiver 1"; | 26 static const char kReceiverId[] = "receiver 1"; |
25 static const char kMessageId[] = "message id 1"; | 27 static const char kMessageId[] = "message id 1"; |
26 static const int kQueuedSec = 5; | 28 static const int kQueuedSec = 5; |
27 static const gcm::MCSClient::MessageSendStatus kMessageSendStatus = | 29 static const gcm::MCSClient::MessageSendStatus kMessageSendStatus = |
28 gcm::MCSClient::QUEUED; | 30 gcm::MCSClient::QUEUED; |
29 static const int kByteSize = 99; | 31 static const int kByteSize = 99; |
30 static const int kTTL = 7; | 32 static const int kTTL = 7; |
31 static const int kRetries = 3; | 33 static const int kRetries = 3; |
32 static const int64 kDelay = 15000; | 34 static const int64_t kDelay = 15000; |
33 static const ConnectionFactory::ConnectionResetReason kReason = | 35 static const ConnectionFactory::ConnectionResetReason kReason = |
34 ConnectionFactory::NETWORK_CHANGE; | 36 ConnectionFactory::NETWORK_CHANGE; |
35 static const int kNetworkError = 1; | 37 static const int kNetworkError = 1; |
36 | 38 |
37 static const RegistrationRequest::Status kRegistrationStatus = | 39 static const RegistrationRequest::Status kRegistrationStatus = |
38 RegistrationRequest::SUCCESS; | 40 RegistrationRequest::SUCCESS; |
39 static const UnregistrationRequest::Status kUnregistrationStatus = | 41 static const UnregistrationRequest::Status kUnregistrationStatus = |
40 UnregistrationRequest::SUCCESS; | 42 UnregistrationRequest::SUCCESS; |
41 | 43 |
42 static const char kCheckinInitiatedEvent[] = "Checkin initiated"; | 44 static const char kCheckinInitiatedEvent[] = "Checkin initiated"; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 recorder_.RecordIncomingSendError(kAppId, kReceiverId, kMessageId); | 520 recorder_.RecordIncomingSendError(kAppId, kReceiverId, kMessageId); |
519 VerifyRecordedSendingCount(3); | 521 VerifyRecordedSendingCount(3); |
520 VerifyIncomingSendError("3rd call"); | 522 VerifyIncomingSendError("3rd call"); |
521 | 523 |
522 recorder_.RecordDataSentToWire(kAppId, kReceiverId, kMessageId, kQueuedSec); | 524 recorder_.RecordDataSentToWire(kAppId, kReceiverId, kMessageId, kQueuedSec); |
523 VerifyRecordedSendingCount(4); | 525 VerifyRecordedSendingCount(4); |
524 VerifyDataSentToWire("4th call"); | 526 VerifyDataSentToWire("4th call"); |
525 } | 527 } |
526 | 528 |
527 } // namespace gcm | 529 } // namespace gcm |
OLD | NEW |