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/message_loop.h" | 8 #include "base/message_loop/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" |
11 #include "components/url_matcher/url_matcher_constants.h" | 11 #include "components/url_matcher/url_matcher_constants.h" |
12 #include "extensions/common/extension_builder.h" | 12 #include "extensions/common/extension_builder.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 using base::test::ParseJson; | 16 using base::test::ParseJson; |
17 using url_matcher::URLMatcher; | 17 using url_matcher::URLMatcher; |
18 using url_matcher::URLMatcherConditionFactory; | 18 using url_matcher::URLMatcherConditionFactory; |
19 using url_matcher::URLMatcherConditionSet; | 19 using url_matcher::URLMatcherConditionSet; |
20 | 20 |
21 namespace extensions { | 21 namespace extensions { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 template<typename T> | 25 template<typename T> |
26 linked_ptr<T> ScopedToLinkedPtr(scoped_ptr<T> ptr) { | 26 linked_ptr<T> ScopedToLinkedPtr(scoped_ptr<T> ptr) { |
27 return linked_ptr<T>(ptr.release()); | 27 return linked_ptr<T>(ptr.release()); |
28 } | 28 } |
29 | 29 |
30 scoped_ptr<DictionaryValue> SimpleManifest() { | 30 scoped_ptr<base::DictionaryValue> SimpleManifest() { |
31 return DictionaryBuilder() | 31 return DictionaryBuilder() |
32 .Set("name", "extension") | 32 .Set("name", "extension") |
33 .Set("manifest_version", 2) | 33 .Set("manifest_version", 2) |
34 .Set("version", "1.0") | 34 .Set("version", "1.0") |
35 .Build(); | 35 .Build(); |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 struct RecordingCondition { | 40 struct RecordingCondition { |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 extension.get(), | 428 extension.get(), |
429 base::Time(), | 429 base::Time(), |
430 json_rule, | 430 json_rule, |
431 base::Bind(AtLeastOneCondition), | 431 base::Bind(AtLeastOneCondition), |
432 &error); | 432 &error); |
433 EXPECT_FALSE(rule); | 433 EXPECT_FALSE(rule); |
434 EXPECT_EQ("No conditions", error); | 434 EXPECT_EQ("No conditions", error); |
435 } | 435 } |
436 | 436 |
437 } // namespace extensions | 437 } // namespace extensions |
OLD | NEW |