OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/data_usage/android/traffic_stats_amortizer.h" | 5 #include "components/data_usage/android/traffic_stats_amortizer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 bool next_traffic_stats_available_; | 140 bool next_traffic_stats_available_; |
141 int64_t next_traffic_stats_tx_bytes_; | 141 int64_t next_traffic_stats_tx_bytes_; |
142 int64_t next_traffic_stats_rx_bytes_; | 142 int64_t next_traffic_stats_rx_bytes_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(TestTrafficStatsAmortizer); | 144 DISALLOW_COPY_AND_ASSIGN(TestTrafficStatsAmortizer); |
145 }; | 145 }; |
146 | 146 |
147 class TrafficStatsAmortizerTest : public testing::Test { | 147 class TrafficStatsAmortizerTest : public testing::Test { |
148 public: | 148 public: |
149 TrafficStatsAmortizerTest() | 149 TrafficStatsAmortizerTest() |
150 : test_tick_clock_(new base::SimpleTestTickClock()), | 150 : test_tick_clock_(new base::SimpleTestTickClock(base::TimeTicks())), |
151 mock_timer_(new MockTimerWithTickClock(false, false, test_tick_clock_)), | 151 mock_timer_(new MockTimerWithTickClock(false, false, test_tick_clock_)), |
152 amortizer_(scoped_ptr<base::TickClock>(test_tick_clock_), | 152 amortizer_(scoped_ptr<base::TickClock>(test_tick_clock_), |
153 scoped_ptr<base::Timer>(mock_timer_)), | 153 scoped_ptr<base::Timer>(mock_timer_)), |
154 data_use_callback_call_count_(0) {} | 154 data_use_callback_call_count_(0) {} |
155 | 155 |
156 ~TrafficStatsAmortizerTest() override { | 156 ~TrafficStatsAmortizerTest() override { |
157 EXPECT_FALSE(mock_timer_->IsRunning()); | 157 EXPECT_FALSE(mock_timer_->IsRunning()); |
158 } | 158 } |
159 | 159 |
160 // Simulates the passage of time by |delta|, firing timers when appropriate. | 160 // Simulates the passage of time by |delta|, firing timers when appropriate. |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 1000 * kExpectedBufSize, 1); | 669 1000 * kExpectedBufSize, 1); |
670 histogram_tester.ExpectUniqueSample(kAmortizationDelayHistogram, 0, 1); | 670 histogram_tester.ExpectUniqueSample(kAmortizationDelayHistogram, 0, 1); |
671 histogram_tester.ExpectUniqueSample(kBufferSizeOnFlushHistogram, | 671 histogram_tester.ExpectUniqueSample(kBufferSizeOnFlushHistogram, |
672 kExpectedBufSize, 1); | 672 kExpectedBufSize, 1); |
673 } | 673 } |
674 | 674 |
675 } // namespace | 675 } // namespace |
676 | 676 |
677 } // namespace android | 677 } // namespace android |
678 } // namespace data_usage | 678 } // namespace data_usage |
OLD | NEW |