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_webrequest/webrequest_rules_
registry.h" | 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_
registry.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 virtual void TearDown() OVERRIDE { | 89 virtual void TearDown() OVERRIDE { |
90 // Make sure that deletion traits of all registries are executed. | 90 // Make sure that deletion traits of all registries are executed. |
91 message_loop_.RunUntilIdle(); | 91 message_loop_.RunUntilIdle(); |
92 } | 92 } |
93 | 93 |
94 // Returns a rule that roughly matches http://*.example.com and | 94 // Returns a rule that roughly matches http://*.example.com and |
95 // https://www.example.com and cancels it | 95 // https://www.example.com and cancels it |
96 linked_ptr<RulesRegistry::Rule> CreateRule1() { | 96 linked_ptr<RulesRegistry::Rule> CreateRule1() { |
97 base::ListValue* scheme_http = new base::ListValue(); | 97 base::ListValue* scheme_http = new base::ListValue(); |
98 scheme_http->Append(Value::CreateStringValue("http")); | 98 scheme_http->Append(new base::StringValue("http")); |
99 base::DictionaryValue* http_condition_dict = new base::DictionaryValue(); | 99 base::DictionaryValue* http_condition_dict = new base::DictionaryValue(); |
100 http_condition_dict->Set(keys2::kSchemesKey, scheme_http); | 100 http_condition_dict->Set(keys2::kSchemesKey, scheme_http); |
101 http_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); | 101 http_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); |
102 base::DictionaryValue http_condition_url_filter; | 102 base::DictionaryValue http_condition_url_filter; |
103 http_condition_url_filter.Set(keys::kUrlKey, http_condition_dict); | 103 http_condition_url_filter.Set(keys::kUrlKey, http_condition_dict); |
104 http_condition_url_filter.SetString(keys::kInstanceTypeKey, | 104 http_condition_url_filter.SetString(keys::kInstanceTypeKey, |
105 keys::kRequestMatcherType); | 105 keys::kRequestMatcherType); |
106 | 106 |
107 base::ListValue* scheme_https = new base::ListValue(); | 107 base::ListValue* scheme_https = new base::ListValue(); |
108 scheme_http->Append(Value::CreateStringValue("https")); | 108 scheme_http->Append(new base::StringValue("https")); |
109 base::DictionaryValue* https_condition_dict = new base::DictionaryValue(); | 109 base::DictionaryValue* https_condition_dict = new base::DictionaryValue(); |
110 https_condition_dict->Set(keys2::kSchemesKey, scheme_https); | 110 https_condition_dict->Set(keys2::kSchemesKey, scheme_https); |
111 https_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); | 111 https_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); |
112 https_condition_dict->SetString(keys2::kHostPrefixKey, "www"); | 112 https_condition_dict->SetString(keys2::kHostPrefixKey, "www"); |
113 base::DictionaryValue https_condition_url_filter; | 113 base::DictionaryValue https_condition_url_filter; |
114 https_condition_url_filter.Set(keys::kUrlKey, https_condition_dict); | 114 https_condition_url_filter.Set(keys::kUrlKey, https_condition_dict); |
115 https_condition_url_filter.SetString(keys::kInstanceTypeKey, | 115 https_condition_url_filter.SetString(keys::kInstanceTypeKey, |
116 keys::kRequestMatcherType); | 116 keys::kRequestMatcherType); |
117 | 117 |
118 base::DictionaryValue action_dict; | 118 base::DictionaryValue action_dict; |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 795 |
796 // This is a correct match. | 796 // This is a correct match. |
797 GURL url2("http://foo.com/index.html"); | 797 GURL url2("http://foo.com/index.html"); |
798 net::TestURLRequest request2(url2, NULL, &context, NULL); | 798 net::TestURLRequest request2(url2, NULL, &context, NULL); |
799 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); | 799 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); |
800 deltas = registry->CreateDeltas(NULL, request_data2, false); | 800 deltas = registry->CreateDeltas(NULL, request_data2, false); |
801 EXPECT_EQ(1u, deltas.size()); | 801 EXPECT_EQ(1u, deltas.size()); |
802 } | 802 } |
803 | 803 |
804 } // namespace extensions | 804 } // namespace extensions |
OLD | NEW |