// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/40285824): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #include "remoting/base/rate_counter.h" #include <stddef.h> #include <stdint.h> #include "base/test/simple_test_tick_clock.h" #include "testing/gtest/include/gtest/gtest.h" namespace remoting { static const int64_t kTestValues[] = …; // One second window and one sample per second, so rate equals each sample. TEST(RateCounterTest, OneSecondWindow) { … } // Record all samples instantaneously, so the rate is the total of the samples. TEST(RateCounterTest, OneSecondWindowAllSamples) { … } // Two second window, one sample per second. For all but the first sample, the // rate should be the average of it and the preceding one. For the first it // will be the average of the sample with zero. TEST(RateCounterTest, TwoSecondWindow) { … } // Sample over a window one second shorter than the number of samples. // Rate should be the average of all but the first sample. TEST(RateCounterTest, LongWindow) { … } } // namespace remoting