| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/declarative_content/chrome_content_rules
_registry.h" | 5 #include "chrome/browser/extensions/api/declarative_content/chrome_content_rules
_registry.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/test/values_test_util.h" | 10 #include "base/test/values_test_util.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 std::string GetPredicateApiAttributeName() const override { | 51 std::string GetPredicateApiAttributeName() const override { |
| 52 return "test_predicate"; | 52 return "test_predicate"; |
| 53 } | 53 } |
| 54 | 54 |
| 55 std::unique_ptr<const ContentPredicate> CreatePredicate( | 55 std::unique_ptr<const ContentPredicate> CreatePredicate( |
| 56 const Extension* extension, | 56 const Extension* extension, |
| 57 const base::Value& value, | 57 const base::Value& value, |
| 58 std::string* error) override { | 58 std::string* error) override { |
| 59 RequestEvaluationIfSpecified(); | 59 RequestEvaluationIfSpecified(); |
| 60 return base::WrapUnique(new TestPredicate(this)); | 60 return base::MakeUnique<TestPredicate>(this); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void TrackPredicates( | 63 void TrackPredicates( |
| 64 const std::map<const void*, | 64 const std::map<const void*, |
| 65 std::vector<const ContentPredicate*>>& predicates) override { | 65 std::vector<const ContentPredicate*>>& predicates) override { |
| 66 RequestEvaluationIfSpecified(); | 66 RequestEvaluationIfSpecified(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void StopTrackingPredicates( | 69 void StopTrackingPredicates( |
| 70 const std::vector<const void*>& predicate_groups) override { | 70 const std::vector<const void*>& predicate_groups) override { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 evaluator->RequestImmediateEvaluation(tab.get(), true); | 195 evaluator->RequestImmediateEvaluation(tab.get(), true); |
| 196 EXPECT_EQ(1u, registry->GetActiveRulesCountForTesting()); | 196 EXPECT_EQ(1u, registry->GetActiveRulesCountForTesting()); |
| 197 | 197 |
| 198 evaluator->RequestEvaluationOnNextOperation(tab.get(), false); | 198 evaluator->RequestEvaluationOnNextOperation(tab.get(), false); |
| 199 registry->DidNavigateMainFrame(tab.get(), content::LoadCommittedDetails(), | 199 registry->DidNavigateMainFrame(tab.get(), content::LoadCommittedDetails(), |
| 200 content::FrameNavigateParams()); | 200 content::FrameNavigateParams()); |
| 201 EXPECT_EQ(0u, registry->GetActiveRulesCountForTesting()); | 201 EXPECT_EQ(0u, registry->GetActiveRulesCountForTesting()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace extensions | 204 } // namespace extensions |
| OLD | NEW |