| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> |
| 6 |
| 5 #include <map> | 7 #include <map> |
| 6 #include <string> | 8 #include <string> |
| 7 | 9 |
| 8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 10 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 11 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" | 13 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" |
| 12 #include "components/data_reduction_proxy/core/browser/data_store.h" | 14 #include "components/data_reduction_proxy/core/browser/data_store.h" |
| 13 #include "components/data_reduction_proxy/core/browser/data_usage_store.h" | 15 #include "components/data_reduction_proxy/core/browser/data_usage_store.h" |
| 14 #include "components/data_reduction_proxy/proto/data_store.pb.h" | 16 #include "components/data_reduction_proxy/proto/data_store.pb.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 41 protected: | 43 protected: |
| 42 void SetUp() override { | 44 void SetUp() override { |
| 43 store_.reset(new TestDataStore()); | 45 store_.reset(new TestDataStore()); |
| 44 data_usage_store_.reset(new DataUsageStore(store_.get())); | 46 data_usage_store_.reset(new DataUsageStore(store_.get())); |
| 45 } | 47 } |
| 46 | 48 |
| 47 int current_bucket_index() const { | 49 int current_bucket_index() const { |
| 48 return data_usage_store_->current_bucket_index_; | 50 return data_usage_store_->current_bucket_index_; |
| 49 } | 51 } |
| 50 | 52 |
| 51 int64 current_bucket_last_updated() const { | 53 int64_t current_bucket_last_updated() const { |
| 52 return data_usage_store_->current_bucket_last_updated_.ToInternalValue(); | 54 return data_usage_store_->current_bucket_last_updated_.ToInternalValue(); |
| 53 } | 55 } |
| 54 | 56 |
| 55 int ComputeBucketIndex(const base::Time& time) const { | 57 int ComputeBucketIndex(const base::Time& time) const { |
| 56 return data_usage_store_->ComputeBucketIndex(time); | 58 return data_usage_store_->ComputeBucketIndex(time); |
| 57 } | 59 } |
| 58 | 60 |
| 59 TestDataStore* store() const { return store_.get(); } | 61 TestDataStore* store() const { return store_.get(); } |
| 60 | 62 |
| 61 DataUsageStore* data_usage_store() const { return data_usage_store_.get(); } | 63 DataUsageStore* data_usage_store() const { return data_usage_store_.get(); } |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 ASSERT_TRUE(store()->map()->find(base::StringPrintf( | 439 ASSERT_TRUE(store()->map()->find(base::StringPrintf( |
| 438 "data_usage_bucket:%d", kNumExpectedBuckets - 2)) != | 440 "data_usage_bucket:%d", kNumExpectedBuckets - 2)) != |
| 439 store()->map()->end()); | 441 store()->map()->end()); |
| 440 | 442 |
| 441 data_usage_store()->DeleteBrowsingHistory(now - base::TimeDelta::FromDays(60), | 443 data_usage_store()->DeleteBrowsingHistory(now - base::TimeDelta::FromDays(60), |
| 442 now); | 444 now); |
| 443 ASSERT_EQ(1u, store()->map()->size()); | 445 ASSERT_EQ(1u, store()->map()->size()); |
| 444 } | 446 } |
| 445 | 447 |
| 446 } // namespace data_reduction_proxy | 448 } // namespace data_reduction_proxy |
| OLD | NEW |