Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 EXPECT_FALSE(prober.IsProbing()); | 58 EXPECT_FALSE(prober.IsProbing()); |
| 59 int64_t now_ms = 0; | 59 int64_t now_ms = 0; |
| 60 EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms)); | 60 EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms)); |
| 61 | 61 |
| 62 prober.SetEnabled(true); | 62 prober.SetEnabled(true); |
| 63 EXPECT_FALSE(prober.IsProbing()); | 63 EXPECT_FALSE(prober.IsProbing()); |
| 64 | 64 |
| 65 prober.OnIncomingPacket(300000, 1000, now_ms); | 65 prober.OnIncomingPacket(300000, 1000, now_ms); |
| 66 EXPECT_TRUE(prober.IsProbing()); | 66 EXPECT_TRUE(prober.IsProbing()); |
| 67 EXPECT_EQ(0, prober.TimeUntilNextProbe(now_ms)); | 67 EXPECT_EQ(0, prober.TimeUntilNextProbe(now_ms)); |
| 68 prober.PacketSent(now_ms, 1000); | |
|
stefan-webrtc
2016/07/29 07:12:07
Did you add this to test the inactivity threshold?
Irfan
2016/08/01 18:29:47
Yes, this is necessary (and makes sense in the flo
| |
| 68 // Let time pass, no large enough packets put into prober. | 69 // Let time pass, no large enough packets put into prober. |
| 69 now_ms += 6000; | 70 now_ms += 6000; |
| 70 EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms)); | 71 EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms)); |
| 71 // Insert a small packet, not a candidate for probing. | 72 // Insert a small packet, not a candidate for probing. |
| 72 prober.OnIncomingPacket(300000, 100, now_ms); | 73 prober.OnIncomingPacket(300000, 100, now_ms); |
| 73 prober.PacketSent(now_ms, 100); | 74 prober.PacketSent(now_ms, 100); |
| 74 EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms)); | 75 EXPECT_EQ(-1, prober.TimeUntilNextProbe(now_ms)); |
| 75 // Insert a large-enough packet after downtime while probing should reset to | 76 // Insert a large-enough packet after downtime while probing should reset to |
| 76 // perform a new probe since the requested one didn't finish. | 77 // perform a new probe since the requested one didn't finish. |
| 77 prober.OnIncomingPacket(300000, 1000, now_ms); | 78 prober.OnIncomingPacket(300000, 1000, now_ms); |
| 78 EXPECT_EQ(0, prober.TimeUntilNextProbe(now_ms)); | 79 EXPECT_EQ(0, prober.TimeUntilNextProbe(now_ms)); |
| 79 prober.PacketSent(now_ms, 1000); | 80 prober.PacketSent(now_ms, 1000); |
| 80 // Next packet should be part of new probe and be sent with non-zero delay. | 81 // Next packet should be part of new probe and be sent with non-zero delay. |
| 81 prober.OnIncomingPacket(300000, 1000, now_ms); | 82 prober.OnIncomingPacket(300000, 1000, now_ms); |
| 82 EXPECT_GT(prober.TimeUntilNextProbe(now_ms), 0); | 83 EXPECT_GT(prober.TimeUntilNextProbe(now_ms), 0); |
| 83 } | 84 } |
| 84 | 85 |
| 85 TEST(BitrateProberTest, DoesntInitializeProbingForSmallPackets) { | 86 TEST(BitrateProberTest, DoesntInitializeProbingForSmallPackets) { |
| 86 BitrateProber prober; | 87 BitrateProber prober; |
| 87 prober.SetEnabled(true); | 88 prober.SetEnabled(true); |
| 88 EXPECT_FALSE(prober.IsProbing()); | 89 EXPECT_FALSE(prober.IsProbing()); |
| 89 | 90 |
| 90 prober.OnIncomingPacket(300000, 100, 0); | 91 prober.OnIncomingPacket(300000, 100, 0); |
| 91 EXPECT_FALSE(prober.IsProbing()); | 92 EXPECT_FALSE(prober.IsProbing()); |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace webrtc | 95 } // namespace webrtc |
| OLD | NEW |