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 <deque> | 7 #include <deque> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 const std::deque<SendingActivity>& queue, | 331 const std::deque<SendingActivity>& queue, |
332 const std::string& event, const std::string& details, | 332 const std::string& event, const std::string& details, |
333 const std::string& remark) { | 333 const std::string& remark) { |
334 EXPECT_EQ(kAppId, queue.front().app_id) << remark; | 334 EXPECT_EQ(kAppId, queue.front().app_id) << remark; |
335 EXPECT_EQ(kReceiverId, queue.front().receiver_id) << remark; | 335 EXPECT_EQ(kReceiverId, queue.front().receiver_id) << remark; |
336 EXPECT_EQ(kMessageId, queue.front().message_id) << remark; | 336 EXPECT_EQ(kMessageId, queue.front().message_id) << remark; |
337 EXPECT_EQ(event, queue.front().event) << remark; | 337 EXPECT_EQ(event, queue.front().event) << remark; |
338 EXPECT_EQ(details, queue.front().details) << remark; | 338 EXPECT_EQ(details, queue.front().details) << remark; |
339 } | 339 } |
340 | 340 |
341 std::vector<std::string> sender_ids_; | 341 std::string sender_ids_; |
342 GCMStatsRecorderImpl recorder_; | 342 GCMStatsRecorderImpl recorder_; |
343 }; | 343 }; |
344 | 344 |
345 GCMStatsRecorderImplTest::GCMStatsRecorderImplTest(){ | 345 GCMStatsRecorderImplTest::GCMStatsRecorderImplTest(){ |
346 } | 346 } |
347 | 347 |
348 GCMStatsRecorderImplTest::~GCMStatsRecorderImplTest() {} | 348 GCMStatsRecorderImplTest::~GCMStatsRecorderImplTest() {} |
349 | 349 |
350 void GCMStatsRecorderImplTest::SetUp(){ | 350 void GCMStatsRecorderImplTest::SetUp(){ |
351 sender_ids_.push_back("s1"); | 351 sender_ids_ = "s1,s2"; |
352 sender_ids_.push_back("s2"); | |
353 recorder_.SetRecording(true); | 352 recorder_.SetRecording(true); |
354 } | 353 } |
355 | 354 |
356 TEST_F(GCMStatsRecorderImplTest, StartStopRecordingTest) { | 355 TEST_F(GCMStatsRecorderImplTest, StartStopRecordingTest) { |
357 EXPECT_TRUE(recorder_.is_recording()); | 356 EXPECT_TRUE(recorder_.is_recording()); |
358 recorder_.RecordDataSentToWire(kAppId, kReceiverId, kMessageId, kQueuedSec); | 357 recorder_.RecordDataSentToWire(kAppId, kReceiverId, kMessageId, kQueuedSec); |
359 VerifyRecordedSendingCount(1); | 358 VerifyRecordedSendingCount(1); |
360 VerifyDataSentToWire("1st call"); | 359 VerifyDataSentToWire("1st call"); |
361 | 360 |
362 recorder_.SetRecording(false); | 361 recorder_.SetRecording(false); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 recorder_.RecordIncomingSendError(kAppId, kReceiverId, kMessageId); | 515 recorder_.RecordIncomingSendError(kAppId, kReceiverId, kMessageId); |
517 VerifyRecordedSendingCount(3); | 516 VerifyRecordedSendingCount(3); |
518 VerifyIncomingSendError("3rd call"); | 517 VerifyIncomingSendError("3rd call"); |
519 | 518 |
520 recorder_.RecordDataSentToWire(kAppId, kReceiverId, kMessageId, kQueuedSec); | 519 recorder_.RecordDataSentToWire(kAppId, kReceiverId, kMessageId, kQueuedSec); |
521 VerifyRecordedSendingCount(4); | 520 VerifyRecordedSendingCount(4); |
522 VerifyDataSentToWire("4th call"); | 521 VerifyDataSentToWire("4th call"); |
523 } | 522 } |
524 | 523 |
525 } // namespace gcm | 524 } // namespace gcm |
OLD | NEW |