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 "net/quic/core/quic_bandwidth.h" | 5 #include "net/quic/core/quic_bandwidth.h" |
6 #include "net/quic/core/quic_time.h" | 6 #include "net/quic/core/quic_time.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "net/quic/platform/api/quic_test.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 namespace test { | 10 namespace test { |
11 | 11 |
12 class QuicBandwidthTest : public ::testing::Test {}; | 12 class QuicBandwidthTest : public QuicTest {}; |
13 | 13 |
14 TEST_F(QuicBandwidthTest, FromTo) { | 14 TEST_F(QuicBandwidthTest, FromTo) { |
15 EXPECT_EQ(QuicBandwidth::FromKBitsPerSecond(1), | 15 EXPECT_EQ(QuicBandwidth::FromKBitsPerSecond(1), |
16 QuicBandwidth::FromBitsPerSecond(1000)); | 16 QuicBandwidth::FromBitsPerSecond(1000)); |
17 EXPECT_EQ(QuicBandwidth::FromKBytesPerSecond(1), | 17 EXPECT_EQ(QuicBandwidth::FromKBytesPerSecond(1), |
18 QuicBandwidth::FromBytesPerSecond(1000)); | 18 QuicBandwidth::FromBytesPerSecond(1000)); |
19 EXPECT_EQ(QuicBandwidth::FromBitsPerSecond(8000), | 19 EXPECT_EQ(QuicBandwidth::FromBitsPerSecond(8000), |
20 QuicBandwidth::FromBytesPerSecond(1000)); | 20 QuicBandwidth::FromBytesPerSecond(1000)); |
21 EXPECT_EQ(QuicBandwidth::FromKBitsPerSecond(8), | 21 EXPECT_EQ(QuicBandwidth::FromKBitsPerSecond(8), |
22 QuicBandwidth::FromKBytesPerSecond(1)); | 22 QuicBandwidth::FromKBytesPerSecond(1)); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 bandwidth = bandwidth * 1000; | 114 bandwidth = bandwidth * 1000; |
115 EXPECT_EQ("400.00 Mbits/s (50.00 Mbytes/s)", bandwidth.ToDebugValue()); | 115 EXPECT_EQ("400.00 Mbits/s (50.00 Mbytes/s)", bandwidth.ToDebugValue()); |
116 | 116 |
117 bandwidth = bandwidth * 1000; | 117 bandwidth = bandwidth * 1000; |
118 EXPECT_EQ("400.00 Gbits/s (50.00 Gbytes/s)", bandwidth.ToDebugValue()); | 118 EXPECT_EQ("400.00 Gbits/s (50.00 Gbytes/s)", bandwidth.ToDebugValue()); |
119 } | 119 } |
120 | 120 |
121 } // namespace test | 121 } // namespace test |
122 } // namespace net | 122 } // namespace net |
OLD | NEW |