| 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/quic_bandwidth.h" | 5 #include "net/quic/quic_bandwidth.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 namespace net { | 8 namespace net { |
| 9 namespace test { | 9 namespace test { |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 EXPECT_EQ(200u, QuicBandwidth::FromKBytesPerSecond(2000).ToKBytesPerPeriod( | 77 EXPECT_EQ(200u, QuicBandwidth::FromKBytesPerSecond(2000).ToKBytesPerPeriod( |
| 78 QuicTime::Delta::FromMilliseconds(100))); | 78 QuicTime::Delta::FromMilliseconds(100))); |
| 79 } | 79 } |
| 80 | 80 |
| 81 TEST_F(QuicBandwidthTest, TransferTime) { | 81 TEST_F(QuicBandwidthTest, TransferTime) { |
| 82 EXPECT_EQ(QuicTime::Delta::FromSeconds(1), | 82 EXPECT_EQ(QuicTime::Delta::FromSeconds(1), |
| 83 QuicBandwidth::FromKBytesPerSecond(1).TransferTime(1000)); | 83 QuicBandwidth::FromKBytesPerSecond(1).TransferTime(1000)); |
| 84 EXPECT_EQ(QuicTime::Delta::Zero(), QuicBandwidth::Zero().TransferTime(1000)); | 84 EXPECT_EQ(QuicTime::Delta::Zero(), QuicBandwidth::Zero().TransferTime(1000)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 TEST_F(QuicBandwidthTest, RelOps) { |
| 88 const QuicBandwidth b1 = QuicBandwidth::FromKBitsPerSecond(1); |
| 89 const QuicBandwidth b2 = QuicBandwidth::FromKBytesPerSecond(2); |
| 90 EXPECT_EQ(b1, b1); |
| 91 EXPECT_NE(b1, b2); |
| 92 EXPECT_LT(b1, b2); |
| 93 EXPECT_GT(b2, b1); |
| 94 EXPECT_LE(b1, b1); |
| 95 EXPECT_LE(b1, b2); |
| 96 EXPECT_GE(b1, b1); |
| 97 EXPECT_GE(b2, b1); |
| 98 } |
| 99 |
| 87 } // namespace test | 100 } // namespace test |
| 88 } // namespace net | 101 } // namespace net |
| OLD | NEW |