OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/extensions/api/declarative/declarative_rule.h" | 5 #include "chrome/browser/extensions/api/declarative/declarative_rule.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/test/values_test_util.h" | 9 #include "base/test/values_test_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 URLMatcherConditionSet::ID url_matcher_condition_set_id() const { | 101 URLMatcherConditionSet::ID url_matcher_condition_set_id() const { |
102 return condition_set_id; | 102 return condition_set_id; |
103 } | 103 } |
104 | 104 |
105 scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set() const { | 105 scoped_refptr<URLMatcherConditionSet> url_matcher_condition_set() const { |
106 return condition_set; | 106 return condition_set; |
107 } | 107 } |
108 | 108 |
109 void GetURLMatcherConditionSets( | 109 void GetURLMatcherConditionSets( |
110 URLMatcherConditionSet::Vector* condition_sets) const { | 110 URLMatcherConditionSet::Vector* condition_sets) const { |
111 if (condition_set) | 111 if (condition_set.get()) |
112 condition_sets->push_back(condition_set); | 112 condition_sets->push_back(condition_set); |
113 } | 113 } |
114 | 114 |
115 bool IsFulfilled(const MatchData& match_data) const { | 115 bool IsFulfilled(const MatchData& match_data) const { |
116 if (condition_set_id != -1 && | 116 if (condition_set_id != -1 && |
117 !ContainsKey(match_data.url_matches, condition_set_id)) | 117 !ContainsKey(match_data.url_matches, condition_set_id)) |
118 return false; | 118 return false; |
119 return match_data.value <= max_value; | 119 return match_data.value <= max_value; |
120 } | 120 } |
121 | 121 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 " \"priority\": 200 \n" | 400 " \"priority\": 200 \n" |
401 "}"), | 401 "}"), |
402 json_rule.get())); | 402 json_rule.get())); |
403 rule = Rule::Create(matcher.condition_factory(), kExtensionId, base::Time(), | 403 rule = Rule::Create(matcher.condition_factory(), kExtensionId, base::Time(), |
404 json_rule, base::Bind(AtLeastOneCondition), &error); | 404 json_rule, base::Bind(AtLeastOneCondition), &error); |
405 EXPECT_FALSE(rule); | 405 EXPECT_FALSE(rule); |
406 EXPECT_EQ("No conditions", error); | 406 EXPECT_EQ("No conditions", error); |
407 } | 407 } |
408 | 408 |
409 } // namespace extensions | 409 } // namespace extensions |
OLD | NEW |