| 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 "base/prefs/testing_pref_service.h" | 5 #include "base/prefs/testing_pref_service.h" |
| 6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
| 7 #include "chrome/browser/extensions/activity_log/activity_actions.h" | 7 #include "chrome/browser/extensions/activity_log/activity_actions.h" |
| 8 #include "components/rappor/byte_vector_utils.h" | 8 #include "components/rappor/byte_vector_utils.h" |
| 9 #include "components/rappor/proto/rappor_metric.pb.h" | 9 #include "components/rappor/proto/rappor_metric.pb.h" |
| 10 #include "components/rappor/rappor_service.h" | 10 #include "components/rappor/rappor_service.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 .Append("http://www.google.co.uk") | 29 .Append("http://www.google.co.uk") |
| 30 .Build()); | 30 .Build()); |
| 31 return action; | 31 return action; |
| 32 } | 32 } |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 class TestRapporService : public rappor::RapporService { | 36 class TestRapporService : public rappor::RapporService { |
| 37 public: | 37 public: |
| 38 TestRapporService(); | 38 TestRapporService(); |
| 39 virtual ~TestRapporService(); | 39 ~TestRapporService() override; |
| 40 | 40 |
| 41 // Returns the active reports. This also clears the internal map of metrics | 41 // Returns the active reports. This also clears the internal map of metrics |
| 42 // as a biproduct, so if comparing numbers of reports, the comparison should | 42 // as a biproduct, so if comparing numbers of reports, the comparison should |
| 43 // be from the last time GetReports() was called (not from the beginning of | 43 // be from the last time GetReports() was called (not from the beginning of |
| 44 // the test). | 44 // the test). |
| 45 rappor::RapporReports GetReports(); | 45 rappor::RapporReports GetReports(); |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 TestingPrefServiceSimple prefs_; | 48 TestingPrefServiceSimple prefs_; |
| 49 }; | 49 }; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 EXPECT_EQ(1, reports.report_size()); | 83 EXPECT_EQ(1, reports.report_size()); |
| 84 | 84 |
| 85 scoped_refptr<Action> harmless_action = | 85 scoped_refptr<Action> harmless_action = |
| 86 CreateAction("Location.replace", "", ""); | 86 CreateAction("Location.replace", "", ""); |
| 87 harmless_action->DidInjectAd(&rappor_service); | 87 harmless_action->DidInjectAd(&rappor_service); |
| 88 reports = rappor_service.GetReports(); | 88 reports = rappor_service.GetReports(); |
| 89 EXPECT_EQ(0, reports.report_size()); | 89 EXPECT_EQ(0, reports.report_size()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace extensions | 92 } // namespace extensions |
| OLD | NEW |