| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "net/quic/congestion_control/quic_receipt_metrics_collector.h" | 7 #include "net/quic/congestion_control/quic_receipt_metrics_collector.h" |
| 8 #include "net/quic/test_tools/mock_clock.h" | 8 #include "net/quic/test_tools/mock_clock.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 namespace test { | 12 namespace test { |
| 13 | 13 |
| 14 class QuicReceiptMetricsCollectorTest : public ::testing::Test { | 14 class QuicReceiptMetricsCollectorTest : public ::testing::Test { |
| 15 protected: | 15 protected: |
| 16 void SetUpCongestionType(CongestionFeedbackType congestion_type) { | 16 void SetUpCongestionType(CongestionFeedbackType congestion_type) { |
| 17 receiver_.reset(new QuicReceiptMetricsCollector(&clock_, congestion_type)); | 17 receiver_.reset(new QuicReceiptMetricsCollector(&clock_, congestion_type)); |
| 18 } | 18 } |
| 19 | 19 |
| 20 MockClock clock_; | 20 MockClock clock_; |
| 21 scoped_ptr<QuicReceiptMetricsCollector> receiver_; | 21 scoped_ptr<QuicReceiptMetricsCollector> receiver_; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 TEST_F(QuicReceiptMetricsCollectorTest, FixedRateReceiverAPI) { | 24 TEST_F(QuicReceiptMetricsCollectorTest, FixedRateReceiverAPI) { |
| 25 SetUpCongestionType(kFixRate); | 25 SetUpCongestionType(kFixRate); |
| 26 QuicCongestionFeedbackFrame feedback; | 26 QuicCongestionFeedbackFrame feedback; |
| 27 QuicTime timestamp; | 27 QuicTime timestamp(QuicTime::Zero()); |
| 28 receiver_->RecordIncomingPacket(1, 1, timestamp, false); | 28 receiver_->RecordIncomingPacket(1, 1, timestamp, false); |
| 29 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback)); | 29 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback)); |
| 30 EXPECT_EQ(kFixRate, feedback.type); | 30 EXPECT_EQ(kFixRate, feedback.type); |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace test | 33 } // namespace test |
| 34 } // namespace net | 34 } // namespace net |
| OLD | NEW |