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 "extensions/browser/api/declarative_webrequest/webrequest_rules_registr
y.h" | 5 #include "extensions/browser/api/declarative_webrequest/webrequest_rules_registr
y.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 void TearDown() override { | 94 void TearDown() override { |
95 // Make sure that deletion traits of all registries are executed. | 95 // Make sure that deletion traits of all registries are executed. |
96 message_loop_.RunUntilIdle(); | 96 message_loop_.RunUntilIdle(); |
97 } | 97 } |
98 | 98 |
99 // Returns a rule that roughly matches http://*.example.com and | 99 // Returns a rule that roughly matches http://*.example.com and |
100 // https://www.example.com and cancels it | 100 // https://www.example.com and cancels it |
101 linked_ptr<api::events::Rule> CreateRule1() { | 101 linked_ptr<api::events::Rule> CreateRule1() { |
102 base::ListValue* scheme_http = new base::ListValue(); | 102 base::ListValue* scheme_http = new base::ListValue(); |
103 scheme_http->Append(new base::StringValue("http")); | 103 scheme_http->AppendString("http"); |
104 base::DictionaryValue* http_condition_dict = new base::DictionaryValue(); | 104 base::DictionaryValue* http_condition_dict = new base::DictionaryValue(); |
105 http_condition_dict->Set(keys2::kSchemesKey, scheme_http); | 105 http_condition_dict->Set(keys2::kSchemesKey, scheme_http); |
106 http_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); | 106 http_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); |
107 base::DictionaryValue http_condition_url_filter; | 107 base::DictionaryValue http_condition_url_filter; |
108 http_condition_url_filter.Set(keys::kUrlKey, http_condition_dict); | 108 http_condition_url_filter.Set(keys::kUrlKey, http_condition_dict); |
109 http_condition_url_filter.SetString(keys::kInstanceTypeKey, | 109 http_condition_url_filter.SetString(keys::kInstanceTypeKey, |
110 keys::kRequestMatcherType); | 110 keys::kRequestMatcherType); |
111 | 111 |
112 base::ListValue* scheme_https = new base::ListValue(); | 112 base::ListValue* scheme_https = new base::ListValue(); |
113 scheme_http->Append(new base::StringValue("https")); | 113 scheme_http->AppendString("https"); |
114 base::DictionaryValue* https_condition_dict = new base::DictionaryValue(); | 114 base::DictionaryValue* https_condition_dict = new base::DictionaryValue(); |
115 https_condition_dict->Set(keys2::kSchemesKey, scheme_https); | 115 https_condition_dict->Set(keys2::kSchemesKey, scheme_https); |
116 https_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); | 116 https_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); |
117 https_condition_dict->SetString(keys2::kHostPrefixKey, "www"); | 117 https_condition_dict->SetString(keys2::kHostPrefixKey, "www"); |
118 base::DictionaryValue https_condition_url_filter; | 118 base::DictionaryValue https_condition_url_filter; |
119 https_condition_url_filter.Set(keys::kUrlKey, https_condition_dict); | 119 https_condition_url_filter.Set(keys::kUrlKey, https_condition_dict); |
120 https_condition_url_filter.SetString(keys::kInstanceTypeKey, | 120 https_condition_url_filter.SetString(keys::kInstanceTypeKey, |
121 keys::kRequestMatcherType); | 121 keys::kRequestMatcherType); |
122 | 122 |
123 base::DictionaryValue action_dict; | 123 base::DictionaryValue action_dict; |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 // This is a correct match. | 809 // This is a correct match. |
810 GURL url2("http://foo.com/index.html"); | 810 GURL url2("http://foo.com/index.html"); |
811 std::unique_ptr<net::URLRequest> request2( | 811 std::unique_ptr<net::URLRequest> request2( |
812 context.CreateRequest(url2, net::DEFAULT_PRIORITY, NULL)); | 812 context.CreateRequest(url2, net::DEFAULT_PRIORITY, NULL)); |
813 WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST); | 813 WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST); |
814 deltas = registry->CreateDeltas(NULL, request_data2, false); | 814 deltas = registry->CreateDeltas(NULL, request_data2, false); |
815 EXPECT_EQ(1u, deltas.size()); | 815 EXPECT_EQ(1u, deltas.size()); |
816 } | 816 } |
817 | 817 |
818 } // namespace extensions | 818 } // namespace extensions |
OLD | NEW |