| OLD | NEW |
| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 protected: | 41 protected: |
| 42 // Policy objects which can be used in tests. | 42 // Policy objects which can be used in tests. |
| 43 enum PolicyObject { | 43 enum PolicyObject { |
| 44 POLICY_OBJECT_NONE, | 44 POLICY_OBJECT_NONE, |
| 45 POLICY_OBJECT_A, | 45 POLICY_OBJECT_A, |
| 46 POLICY_OBJECT_B | 46 POLICY_OBJECT_B |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 CloudPolicyInvalidatorTest(); | 49 CloudPolicyInvalidatorTest(); |
| 50 | 50 |
| 51 virtual void TearDown() OVERRIDE; | 51 virtual void TearDown() override; |
| 52 | 52 |
| 53 // Starts the invalidator which will be tested. | 53 // Starts the invalidator which will be tested. |
| 54 // |initialize| determines if the invalidator should be initialized. | 54 // |initialize| determines if the invalidator should be initialized. |
| 55 // |start_refresh_scheduler| determines if the refresh scheduler should start. | 55 // |start_refresh_scheduler| determines if the refresh scheduler should start. |
| 56 // |highest_handled_invalidation_version| is the highest invalidation version | 56 // |highest_handled_invalidation_version| is the highest invalidation version |
| 57 // that was handled already before this invalidator was created. | 57 // that was handled already before this invalidator was created. |
| 58 void StartInvalidator(bool initialize, | 58 void StartInvalidator(bool initialize, |
| 59 bool start_refresh_scheduler, | 59 bool start_refresh_scheduler, |
| 60 int64 highest_handled_invalidation_version); | 60 int64 highest_handled_invalidation_version); |
| 61 void StartInvalidator() { | 61 void StartInvalidator() { |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 } | 847 } |
| 848 | 848 |
| 849 class CloudPolicyInvalidatorUserTypedTest | 849 class CloudPolicyInvalidatorUserTypedTest |
| 850 : public CloudPolicyInvalidatorTest, | 850 : public CloudPolicyInvalidatorTest, |
| 851 public testing::WithParamInterface<em::DeviceRegisterRequest::Type> { | 851 public testing::WithParamInterface<em::DeviceRegisterRequest::Type> { |
| 852 protected: | 852 protected: |
| 853 CloudPolicyInvalidatorUserTypedTest(); | 853 CloudPolicyInvalidatorUserTypedTest(); |
| 854 virtual ~CloudPolicyInvalidatorUserTypedTest(); | 854 virtual ~CloudPolicyInvalidatorUserTypedTest(); |
| 855 | 855 |
| 856 // CloudPolicyInvalidatorTest: | 856 // CloudPolicyInvalidatorTest: |
| 857 virtual void SetUp() OVERRIDE; | 857 virtual void SetUp() override; |
| 858 | 858 |
| 859 // Get the current count for the given metric. | 859 // Get the current count for the given metric. |
| 860 base::HistogramBase::Count GetCount(MetricPolicyRefresh metric); | 860 base::HistogramBase::Count GetCount(MetricPolicyRefresh metric); |
| 861 base::HistogramBase::Count GetInvalidationCount(PolicyInvalidationType type); | 861 base::HistogramBase::Count GetInvalidationCount(PolicyInvalidationType type); |
| 862 | 862 |
| 863 private: | 863 private: |
| 864 // CloudPolicyInvalidatorTest: | 864 // CloudPolicyInvalidatorTest: |
| 865 virtual em::DeviceRegisterRequest::Type GetPolicyType() const OVERRIDE; | 865 virtual em::DeviceRegisterRequest::Type GetPolicyType() const override; |
| 866 | 866 |
| 867 // Get histogram samples for the given histogram. | 867 // Get histogram samples for the given histogram. |
| 868 scoped_ptr<base::HistogramSamples> GetHistogramSamples( | 868 scoped_ptr<base::HistogramSamples> GetHistogramSamples( |
| 869 const std::string& name) const; | 869 const std::string& name) const; |
| 870 | 870 |
| 871 // Stores starting histogram counts for kMetricPolicyRefresh. | 871 // Stores starting histogram counts for kMetricPolicyRefresh. |
| 872 scoped_ptr<base::HistogramSamples> refresh_samples_; | 872 scoped_ptr<base::HistogramSamples> refresh_samples_; |
| 873 | 873 |
| 874 // Stores starting histogram counts for kMetricPolicyInvalidations. | 874 // Stores starting histogram counts for kMetricPolicyInvalidations. |
| 875 scoped_ptr<base::HistogramSamples> invalidations_samples_; | 875 scoped_ptr<base::HistogramSamples> invalidations_samples_; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 CloudPolicyInvalidatorUserTypedTest, | 1101 CloudPolicyInvalidatorUserTypedTest, |
| 1102 testing::Values(em::DeviceRegisterRequest::IOS_BROWSER)); | 1102 testing::Values(em::DeviceRegisterRequest::IOS_BROWSER)); |
| 1103 #else | 1103 #else |
| 1104 INSTANTIATE_TEST_CASE_P( | 1104 INSTANTIATE_TEST_CASE_P( |
| 1105 CloudPolicyInvalidatorUserTypedTestInstance, | 1105 CloudPolicyInvalidatorUserTypedTestInstance, |
| 1106 CloudPolicyInvalidatorUserTypedTest, | 1106 CloudPolicyInvalidatorUserTypedTest, |
| 1107 testing::Values(em::DeviceRegisterRequest::BROWSER)); | 1107 testing::Values(em::DeviceRegisterRequest::BROWSER)); |
| 1108 #endif | 1108 #endif |
| 1109 | 1109 |
| 1110 } // namespace policy | 1110 } // namespace policy |
| OLD | NEW |