Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: net/quic/congestion_control/leaky_bucket_test.cc

Issue 12813004: Chromium style checker cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer.cc ('k') | net/quic/crypto/crypto_framer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/leaky_bucket.h" 7 #include "net/quic/congestion_control/leaky_bucket.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 LeakyBucketTest : public ::testing::Test { 14 class LeakyBucketTest : public ::testing::Test {
15 protected: 15 protected:
16 void SetUp() { 16 virtual void SetUp() {
17 leaky_bucket_.reset(new LeakyBucket(QuicBandwidth::Zero())); 17 leaky_bucket_.reset(new LeakyBucket(QuicBandwidth::Zero()));
18 } 18 }
19 MockClock clock_; 19 MockClock clock_;
20 scoped_ptr<LeakyBucket> leaky_bucket_; 20 scoped_ptr<LeakyBucket> leaky_bucket_;
21 }; 21 };
22 22
23 TEST_F(LeakyBucketTest, Basic) { 23 TEST_F(LeakyBucketTest, Basic) {
24 QuicBandwidth draining_rate = QuicBandwidth::FromBytesPerSecond(200000); 24 QuicBandwidth draining_rate = QuicBandwidth::FromBytesPerSecond(200000);
25 leaky_bucket_->SetDrainingRate(clock_.Now(), draining_rate); 25 leaky_bucket_->SetDrainingRate(clock_.Now(), draining_rate);
26 leaky_bucket_->Add(clock_.Now(), 2000); 26 leaky_bucket_->Add(clock_.Now(), 2000);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 leaky_bucket_->TimeRemaining(clock_.Now())); 66 leaky_bucket_->TimeRemaining(clock_.Now()));
67 draining_rate = draining_rate.Scale(0.5f); // Cut drain rate in half. 67 draining_rate = draining_rate.Scale(0.5f); // Cut drain rate in half.
68 leaky_bucket_->SetDrainingRate(clock_.Now(), draining_rate); 68 leaky_bucket_->SetDrainingRate(clock_.Now(), draining_rate);
69 EXPECT_EQ(1000u, leaky_bucket_->BytesPending(clock_.Now())); 69 EXPECT_EQ(1000u, leaky_bucket_->BytesPending(clock_.Now()));
70 EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10), 70 EXPECT_EQ(QuicTime::Delta::FromMilliseconds(10),
71 leaky_bucket_->TimeRemaining(clock_.Now())); 71 leaky_bucket_->TimeRemaining(clock_.Now()));
72 } 72 }
73 73
74 } // namespace test 74 } // namespace test
75 } // namespace net 75 } // namespace net
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer.cc ('k') | net/quic/crypto/crypto_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698