| 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/core/data_use_aggregator.h" | 5 #include "components/data_usage/core/data_use_aggregator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/run_loop.h" |
| 19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 20 #include "components/data_usage/core/data_use.h" | 21 #include "components/data_usage/core/data_use.h" |
| 21 #include "components/data_usage/core/data_use_amortizer.h" | 22 #include "components/data_usage/core/data_use_amortizer.h" |
| 22 #include "components/data_usage/core/data_use_annotator.h" | 23 #include "components/data_usage/core/data_use_annotator.h" |
| 23 #include "net/base/load_timing_info.h" | 24 #include "net/base/load_timing_info.h" |
| 24 #include "net/base/network_change_notifier.h" | 25 #include "net/base/network_change_notifier.h" |
| 25 #include "net/base/network_delegate_impl.h" | 26 #include "net/base/network_delegate_impl.h" |
| 26 #include "net/socket/socket_test_util.h" | 27 #include "net/socket/socket_test_util.h" |
| 27 #include "net/url_request/url_request.h" | 28 #include "net/url_request/url_request.h" |
| 28 #include "net/url_request/url_request_test_util.h" | 29 #include "net/url_request/url_request_test_util.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 observed_bar_rx_bytes); | 416 observed_bar_rx_bytes); |
| 416 } | 417 } |
| 417 } | 418 } |
| 418 | 419 |
| 419 TEST_F(DataUseAggregatorTest, ReportOffTheRecordDataUse) { | 420 TEST_F(DataUseAggregatorTest, ReportOffTheRecordDataUse) { |
| 420 Initialize(std::unique_ptr<FakeDataUseAnnotator>(new FakeDataUseAnnotator()), | 421 Initialize(std::unique_ptr<FakeDataUseAnnotator>(new FakeDataUseAnnotator()), |
| 421 std::unique_ptr<DataUseAmortizer>(new DoublingAmortizer())); | 422 std::unique_ptr<DataUseAmortizer>(new DoublingAmortizer())); |
| 422 | 423 |
| 423 // Off the record data use should not be reported to observers. | 424 // Off the record data use should not be reported to observers. |
| 424 data_use_aggregator()->ReportOffTheRecordDataUse(1000, 1000); | 425 data_use_aggregator()->ReportOffTheRecordDataUse(1000, 1000); |
| 425 base::MessageLoop::current()->RunUntilIdle(); | 426 base::RunLoop().RunUntilIdle(); |
| 426 EXPECT_EQ(static_cast<size_t>(0), | 427 EXPECT_EQ(static_cast<size_t>(0), |
| 427 test_observer()->observed_data_use().size()); | 428 test_observer()->observed_data_use().size()); |
| 428 } | 429 } |
| 429 | 430 |
| 430 } // namespace | 431 } // namespace |
| 431 | 432 |
| 432 } // namespace data_usage | 433 } // namespace data_usage |
| OLD | NEW |