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

Side by Side Diff: remoting/base/rate_counter_unittest.cc

Issue 1542203002: Switch to standard integer types in remoting/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-remoting-host
Patch Set: Created 5 years 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
« no previous file with comments | « remoting/base/rate_counter.cc ('k') | remoting/base/rsa_key_pair.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h>
6 #include <stdint.h>
7
8 #include "base/macros.h"
5 #include "remoting/base/rate_counter.h" 9 #include "remoting/base/rate_counter.h"
6 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
7 11
8 namespace remoting { 12 namespace remoting {
9 13
10 static const int64 kTestValues[] = { 10, 20, 30, 10, 25, 16, 15 }; 14 static const int64_t kTestValues[] = { 10, 20, 30, 10, 25, 16, 15 };
11 15
12 // One second window and one sample per second, so rate equals each sample. 16 // One second window and one sample per second, so rate equals each sample.
13 TEST(RateCounterTest, OneSecondWindow) { 17 TEST(RateCounterTest, OneSecondWindow) {
14 RateCounter rate_counter(base::TimeDelta::FromSeconds(1)); 18 RateCounter rate_counter(base::TimeDelta::FromSeconds(1));
15 EXPECT_EQ(0, rate_counter.Rate()); 19 EXPECT_EQ(0, rate_counter.Rate());
16 20
17 base::Time now = base::Time::Now(); 21 base::Time now = base::Time::Now();
18 for (size_t i = 0; i < arraysize(kTestValues); ++i) { 22 for (size_t i = 0; i < arraysize(kTestValues); ++i) {
19 now += base::TimeDelta::FromSeconds(1); 23 now += base::TimeDelta::FromSeconds(1);
20 rate_counter.SetCurrentTimeForTest(now); 24 rate_counter.SetCurrentTimeForTest(now);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 rate_counter.Record(kTestValues[i]); 79 rate_counter.Record(kTestValues[i]);
76 if (i != 0) 80 if (i != 0)
77 expected += kTestValues[i]; 81 expected += kTestValues[i];
78 } 82 }
79 expected /= kWindowSeconds; 83 expected /= kWindowSeconds;
80 84
81 EXPECT_EQ(expected, rate_counter.Rate()); 85 EXPECT_EQ(expected, rate_counter.Rate());
82 } 86 }
83 87
84 } // namespace remoting 88 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/base/rate_counter.cc ('k') | remoting/base/rsa_key_pair.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698