Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc

Issue 11414230: Declarative Web Request: firstPartyForCookiesUrl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More checks and one more unit test Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_condit ion.h" 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit ion.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector>
8 9
9 #include "base/message_loop.h" 10 #include "base/message_loop.h"
10 #include "base/test/values_test_util.h" 11 #include "base/test/values_test_util.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h" 13 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h"
13 #include "chrome/common/extensions/matcher/url_matcher_constants.h" 14 #include "chrome/common/extensions/matcher/url_matcher_constants.h"
14 #include "content/public/browser/resource_request_info.h" 15 #include "content/public/browser/resource_request_info.h"
15 #include "net/url_request/url_request_test_util.h" 16 #include "net/url_request/url_request_test_util.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 namespace extensions { 19 namespace extensions {
19 20
20 namespace keys = declarative_webrequest_constants; 21 namespace keys = declarative_webrequest_constants;
21 namespace keys2 = url_matcher_constants; 22 namespace keys2 = url_matcher_constants;
22 23
23 TEST(WebRequestConditionTest, CreateCondition) { 24 TEST(WebRequestConditionTest, CreateCondition) {
24 // Necessary for TestURLRequest. 25 // Necessary for TestURLRequest.
25 MessageLoop message_loop(MessageLoop::TYPE_IO); 26 MessageLoop message_loop(MessageLoop::TYPE_IO);
26 URLMatcher matcher; 27 URLMatcher matcher;
28 URLMatcher first_party_matcher;
27 29
28 std::string error; 30 std::string error;
29 scoped_ptr<WebRequestCondition> result; 31 scoped_ptr<WebRequestCondition> result;
30 32
33 std::vector<URLMatcherConditionFactory*> factories;
34 factories.push_back(matcher.condition_factory());
35 factories.push_back(first_party_matcher.condition_factory());
31 36
32 // Test wrong condition name passed. 37 // Test wrong condition name passed.
33 error.clear(); 38 error.clear();
34 result = WebRequestCondition::Create( 39 result = WebRequestCondition::Create(
35 matcher.condition_factory(), 40 factories,
36 *base::test::ParseJson( 41 *base::test::ParseJson(
37 "{ \"invalid\": \"foobar\", \n" 42 "{ \"invalid\": \"foobar\", \n"
38 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 43 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
39 "}"), 44 "}"),
40 &error); 45 &error);
41 EXPECT_FALSE(error.empty()); 46 EXPECT_FALSE(error.empty());
42 EXPECT_FALSE(result.get()); 47 EXPECT_FALSE(result.get());
43 48
44 // Test wrong datatype in host_suffix. 49 // Test wrong datatype in host_suffix.
45 error.clear(); 50 error.clear();
46 result = WebRequestCondition::Create( 51 result = WebRequestCondition::Create(
47 matcher.condition_factory(), 52 factories,
48 *base::test::ParseJson( 53 *base::test::ParseJson(
49 "{ \n" 54 "{ \n"
50 " \"url\": [], \n" 55 " \"url\": [], \n"
51 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 56 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
52 "}"), 57 "}"),
53 &error); 58 &error);
54 EXPECT_FALSE(error.empty()); 59 EXPECT_FALSE(error.empty());
55 EXPECT_FALSE(result.get()); 60 EXPECT_FALSE(result.get());
56 61
57 // Test success (can we support multiple criteria?) 62 // Test success (can we support multiple criteria?)
58 error.clear(); 63 error.clear();
59 result = WebRequestCondition::Create( 64 result = WebRequestCondition::Create(
60 matcher.condition_factory(), 65 factories,
61 *base::test::ParseJson( 66 *base::test::ParseJson(
62 "{ \n" 67 "{ \n"
63 " \"resourceType\": [\"main_frame\"], \n" 68 " \"resourceType\": [\"main_frame\"], \n"
64 " \"url\": { \"hostSuffix\": \"example.com\" }, \n" 69 " \"url\": { \"hostSuffix\": \"example.com\" }, \n"
70 " \"firstPartyForCookiesUrl\": { \"hostPrefix\": \"fpfc\"}, \n"
65 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 71 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
66 "}"), 72 "}"),
67 &error); 73 &error);
68 EXPECT_EQ("", error); 74 EXPECT_EQ("", error);
69 ASSERT_TRUE(result.get()); 75 ASSERT_TRUE(result.get());
70 76
71 URLMatcherConditionSet::Vector url_matcher_condition_set; 77 URLMatcherConditionSet::Vector url_matcher_condition_set;
72 result->GetURLMatcherConditionSets(&url_matcher_condition_set); 78 ASSERT_EQ(1,
79 result->GetURLMatcherConditionSets(&url_matcher_condition_set, 0));
73 matcher.AddConditionSets(url_matcher_condition_set); 80 matcher.AddConditionSets(url_matcher_condition_set);
74 std::set<URLMatcherConditionSet::ID> url_match_ids; 81 url_matcher_condition_set.clear();
82 ASSERT_EQ(-1,
83 result->GetURLMatcherConditionSets(&url_matcher_condition_set, 1));
84 first_party_matcher.AddConditionSets(url_matcher_condition_set);
75 85
76 net::TestURLRequestContext context; 86 net::TestURLRequestContext context;
77 GURL http_url("http://www.example.com"); 87 GURL http_url("http://www.example.com");
88 GURL first_party_url("http://fpfc.example.com");
78 net::TestURLRequest match_request(http_url, NULL, &context); 89 net::TestURLRequest match_request(http_url, NULL, &context);
79 url_match_ids = matcher.MatchURL(http_url); 90 std::set<URLMatcherConditionSet::ID> url_match_ids =
80 EXPECT_EQ(1u, url_match_ids.size()); 91 matcher.MatchURL(http_url);
92 std::set<URLMatcherConditionSet::ID> first_party_url_match_ids =
93 first_party_matcher.MatchURL(first_party_url);
94 url_match_ids.insert(first_party_url_match_ids.begin(),
95 first_party_url_match_ids.end());
96 EXPECT_EQ(2u, url_match_ids.size());
81 content::ResourceRequestInfo::AllocateForTesting(&match_request, 97 content::ResourceRequestInfo::AllocateForTesting(&match_request,
82 ResourceType::MAIN_FRAME, NULL, -1, -1); 98 ResourceType::MAIN_FRAME, NULL, -1, -1);
83 EXPECT_TRUE(result->IsFulfilled( 99 EXPECT_TRUE(result->IsFulfilled(
84 url_match_ids, 100 url_match_ids,
85 DeclarativeWebRequestData(&match_request, ON_BEFORE_REQUEST))); 101 DeclarativeWebRequestData(&match_request, ON_BEFORE_REQUEST)));
86 102
87 GURL https_url("https://www.example.com"); 103 GURL https_url("https://www.example.com");
88 net::TestURLRequest wrong_resource_type(https_url, NULL, &context); 104 net::TestURLRequest wrong_resource_type(https_url, NULL, &context);
89 url_match_ids = matcher.MatchURL(https_url); 105 url_match_ids = matcher.MatchURL(https_url);
106 url_match_ids.insert(first_party_url_match_ids.begin(),
107 first_party_url_match_ids.end());
90 // Make sure IsFulfilled does not fail because of URL matching. 108 // Make sure IsFulfilled does not fail because of URL matching.
91 EXPECT_EQ(1u, url_match_ids.size()); 109 EXPECT_EQ(2u, url_match_ids.size());
92 content::ResourceRequestInfo::AllocateForTesting(&wrong_resource_type, 110 content::ResourceRequestInfo::AllocateForTesting(&wrong_resource_type,
93 ResourceType::SUB_FRAME, NULL, -1, -1); 111 ResourceType::SUB_FRAME, NULL, -1, -1);
94 EXPECT_FALSE(result->IsFulfilled( 112 EXPECT_FALSE(result->IsFulfilled(
95 url_match_ids, 113 url_match_ids,
96 DeclarativeWebRequestData(&wrong_resource_type, ON_BEFORE_REQUEST))); 114 DeclarativeWebRequestData(&wrong_resource_type, ON_BEFORE_REQUEST)));
97 } 115 }
98 116
99 // Conditions without UrlFilter attributes need to be independent of URL 117 // Conditions without UrlFilter attributes need to be independent of URL
100 // matching results. We test here that: 118 // matching results. We test here that:
101 // 1. A non-empty condition without UrlFilter attributes is fulfilled iff its 119 // 1. A non-empty condition without UrlFilter attributes is fulfilled iff its
102 // attributes are fulfilled. 120 // attributes are fulfilled.
103 // 2. An empty condition (in particular, without UrlFilter attributes) is 121 // 2. An empty condition (in particular, without UrlFilter attributes) is
104 // always fulfilled. 122 // always fulfilled.
105 TEST(WebRequestConditionTest, NoUrlAttributes) { 123 TEST(WebRequestConditionTest, NoUrlAttributes) {
106 // Necessary for TestURLRequest. 124 // Necessary for TestURLRequest.
107 MessageLoop message_loop(MessageLoop::TYPE_IO); 125 MessageLoop message_loop(MessageLoop::TYPE_IO);
108 URLMatcher matcher; 126 URLMatcher matcher;
109 std::string error; 127 std::string error;
110 128
129 std::vector<URLMatcherConditionFactory*> factories;
130 factories.push_back(matcher.condition_factory());
131 // The second factory is usually from a different matcher, but in this test
132 // we don't care, since we never use it.
133 factories.push_back(matcher.condition_factory());
134
111 // The empty condition. 135 // The empty condition.
112 error.clear(); 136 error.clear();
113 scoped_ptr<WebRequestCondition> condition_empty = WebRequestCondition::Create( 137 scoped_ptr<WebRequestCondition> condition_empty = WebRequestCondition::Create(
114 matcher.condition_factory(), 138 factories,
115 *base::test::ParseJson( 139 *base::test::ParseJson(
116 "{ \n" 140 "{ \n"
117 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 141 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
118 "}"), 142 "}"),
119 &error); 143 &error);
120 EXPECT_EQ("", error); 144 EXPECT_EQ("", error);
121 ASSERT_TRUE(condition_empty.get()); 145 ASSERT_TRUE(condition_empty.get());
122 146
123 // A condition without a UrlFilter attribute, which is always true. 147 // A condition without a UrlFilter attribute, which is always true.
124 error.clear(); 148 error.clear();
125 scoped_ptr<WebRequestCondition> condition_no_url_true = 149 scoped_ptr<WebRequestCondition> condition_no_url_true =
126 WebRequestCondition::Create( 150 WebRequestCondition::Create(
127 matcher.condition_factory(), 151 factories,
128 *base::test::ParseJson( 152 *base::test::ParseJson(
129 "{ \n" 153 "{ \n"
130 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 154 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
131 // There is no "1st party for cookies" URL in the requests below, 155 // There is no "1st party for cookies" URL in the requests below,
132 // therefore all requests are considered first party for cookies. 156 // therefore all requests are considered first party for cookies.
133 " \"thirdPartyForCookies\": false, \n" 157 " \"thirdPartyForCookies\": false, \n"
134 "}"), 158 "}"),
135 &error); 159 &error);
136 EXPECT_EQ("", error); 160 EXPECT_EQ("", error);
137 ASSERT_TRUE(condition_no_url_true.get()); 161 ASSERT_TRUE(condition_no_url_true.get());
138 162
139 // A condition without a UrlFilter attribute, which is always false. 163 // A condition without a UrlFilter attribute, which is always false.
140 error.clear(); 164 error.clear();
141 scoped_ptr<WebRequestCondition> condition_no_url_false = 165 scoped_ptr<WebRequestCondition> condition_no_url_false =
142 WebRequestCondition::Create( 166 WebRequestCondition::Create(
143 matcher.condition_factory(), 167 factories,
144 *base::test::ParseJson( 168 *base::test::ParseJson(
145 "{ \n" 169 "{ \n"
146 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 170 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
147 " \"thirdPartyForCookies\": true, \n" 171 " \"thirdPartyForCookies\": true, \n"
148 "}"), 172 "}"),
149 &error); 173 &error);
150 EXPECT_EQ("", error); 174 EXPECT_EQ("", error);
151 ASSERT_TRUE(condition_no_url_false.get()); 175 ASSERT_TRUE(condition_no_url_false.get());
152 176
153 net::TestURLRequestContext context; 177 net::TestURLRequestContext context;
(...skipping 16 matching lines...) Expand all
170 EXPECT_TRUE(condition_empty->IsFulfilled( 194 EXPECT_TRUE(condition_empty->IsFulfilled(
171 dummy_match_set, 195 dummy_match_set,
172 DeclarativeWebRequestData(&https_request, ON_BEFORE_REQUEST))); 196 DeclarativeWebRequestData(&https_request, ON_BEFORE_REQUEST)));
173 } 197 }
174 198
175 TEST(WebRequestConditionTest, CreateConditionSet) { 199 TEST(WebRequestConditionTest, CreateConditionSet) {
176 // Necessary for TestURLRequest. 200 // Necessary for TestURLRequest.
177 MessageLoop message_loop(MessageLoop::TYPE_IO); 201 MessageLoop message_loop(MessageLoop::TYPE_IO);
178 URLMatcher matcher; 202 URLMatcher matcher;
179 203
204 std::vector<URLMatcherConditionFactory*> factories;
205 factories.push_back(matcher.condition_factory());
206 // The second factory is usually from a different matcher, but in this test
207 // we don't care, since we never use it.
208 factories.push_back(matcher.condition_factory());
209
180 WebRequestConditionSet::AnyVector conditions; 210 WebRequestConditionSet::AnyVector conditions;
181 conditions.push_back(linked_ptr<base::Value>(base::test::ParseJson( 211 conditions.push_back(linked_ptr<base::Value>(base::test::ParseJson(
182 "{ \n" 212 "{ \n"
183 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 213 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
184 " \"url\": { \n" 214 " \"url\": { \n"
185 " \"hostSuffix\": \"example.com\", \n" 215 " \"hostSuffix\": \"example.com\", \n"
186 " \"schemes\": [\"http\"], \n" 216 " \"schemes\": [\"http\"], \n"
187 " }, \n" 217 " }, \n"
188 "}").release())); 218 "}").release()));
189 conditions.push_back(linked_ptr<base::Value>(base::test::ParseJson( 219 conditions.push_back(linked_ptr<base::Value>(base::test::ParseJson(
190 "{ \n" 220 "{ \n"
191 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 221 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
192 " \"url\": { \n" 222 " \"url\": { \n"
193 " \"hostSuffix\": \"example.com\", \n" 223 " \"hostSuffix\": \"example.com\", \n"
194 " \"hostPrefix\": \"www\", \n" 224 " \"hostPrefix\": \"www\", \n"
195 " \"schemes\": [\"https\"], \n" 225 " \"schemes\": [\"https\"], \n"
196 " }, \n" 226 " }, \n"
197 "}").release())); 227 "}").release()));
198 228
199 // Test insertion 229 // Test insertion
200 std::string error; 230 std::string error;
201 scoped_ptr<WebRequestConditionSet> result = 231 scoped_ptr<WebRequestConditionSet> result =
202 WebRequestConditionSet::Create(matcher.condition_factory(), 232 WebRequestConditionSet::Create(factories, conditions, &error);
203 conditions, &error);
204 EXPECT_EQ("", error); 233 EXPECT_EQ("", error);
205 ASSERT_TRUE(result.get()); 234 ASSERT_TRUE(result.get());
206 EXPECT_EQ(2u, result->conditions().size()); 235 EXPECT_EQ(2u, result->conditions().size());
207 236
208 // Tell the URLMatcher about our shiny new patterns. 237 // Tell the URLMatcher about our shiny new patterns.
209 URLMatcherConditionSet::Vector url_matcher_condition_set; 238 URLMatcherConditionSet::Vector url_matcher_condition_set;
210 result->GetURLMatcherConditionSets(&url_matcher_condition_set); 239 result->GetURLMatcherConditionSets(&url_matcher_condition_set, 0);
211 matcher.AddConditionSets(url_matcher_condition_set); 240 matcher.AddConditionSets(url_matcher_condition_set);
212 241
213 std::set<URLMatcherConditionSet::ID> url_match_ids; 242 std::set<URLMatcherConditionSet::ID> url_match_ids;
214 243
215 // Test that the result is correct and matches http://www.example.com and 244 // Test that the result is correct and matches http://www.example.com and
216 // https://www.example.com 245 // https://www.example.com
217 GURL http_url("http://www.example.com"); 246 GURL http_url("http://www.example.com");
218 net::TestURLRequestContext context; 247 net::TestURLRequestContext context;
219 net::TestURLRequest http_request(http_url, NULL, &context); 248 net::TestURLRequest http_request(http_url, NULL, &context);
220 url_match_ids = matcher.MatchURL(http_url); 249 url_match_ids = matcher.MatchURL(http_url);
(...skipping 21 matching lines...) Expand all
242 -1, 271 -1,
243 url_match_ids, 272 url_match_ids,
244 DeclarativeWebRequestData(&https_foo_request, ON_BEFORE_REQUEST))); 273 DeclarativeWebRequestData(&https_foo_request, ON_BEFORE_REQUEST)));
245 } 274 }
246 275
247 TEST(WebRequestConditionTest, TestPortFilter) { 276 TEST(WebRequestConditionTest, TestPortFilter) {
248 // Necessary for TestURLRequest. 277 // Necessary for TestURLRequest.
249 MessageLoop message_loop(MessageLoop::TYPE_IO); 278 MessageLoop message_loop(MessageLoop::TYPE_IO);
250 URLMatcher matcher; 279 URLMatcher matcher;
251 280
281 std::vector<URLMatcherConditionFactory*> factories;
282 factories.push_back(matcher.condition_factory());
283 // The second factory is usually from a different matcher, but in this test
284 // we don't care, since we never use it.
285 factories.push_back(matcher.condition_factory());
286
252 WebRequestConditionSet::AnyVector conditions; 287 WebRequestConditionSet::AnyVector conditions;
253 conditions.push_back(linked_ptr<base::Value>(base::test::ParseJson( 288 conditions.push_back(linked_ptr<base::Value>(base::test::ParseJson(
254 "{ \n" 289 "{ \n"
255 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 290 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
256 " \"url\": { \n" 291 " \"url\": { \n"
257 " \"ports\": [80, [1000, 1010]], \n" // Allow 80;1000-1010. 292 " \"ports\": [80, [1000, 1010]], \n" // Allow 80;1000-1010.
258 " \"hostSuffix\": \"example.com\", \n" 293 " \"hostSuffix\": \"example.com\", \n"
259 " }, \n" 294 " }, \n"
260 "}").release())); 295 "}").release()));
261 296
262 // Test insertion 297 // Test insertion
263 std::string error; 298 std::string error;
264 scoped_ptr<WebRequestConditionSet> result = 299 scoped_ptr<WebRequestConditionSet> result =
265 WebRequestConditionSet::Create(matcher.condition_factory(), 300 WebRequestConditionSet::Create(factories, conditions, &error);
266 conditions, &error);
267 EXPECT_EQ("", error); 301 EXPECT_EQ("", error);
268 ASSERT_TRUE(result.get()); 302 ASSERT_TRUE(result.get());
269 EXPECT_EQ(1u, result->conditions().size()); 303 EXPECT_EQ(1u, result->conditions().size());
270 304
271 // Tell the URLMatcher about our shiny new patterns. 305 // Tell the URLMatcher about our shiny new patterns.
272 URLMatcherConditionSet::Vector url_matcher_condition_set; 306 URLMatcherConditionSet::Vector url_matcher_condition_set;
273 result->GetURLMatcherConditionSets(&url_matcher_condition_set); 307 result->GetURLMatcherConditionSets(&url_matcher_condition_set, 0);
274 matcher.AddConditionSets(url_matcher_condition_set); 308 matcher.AddConditionSets(url_matcher_condition_set);
275 309
276 std::set<URLMatcherConditionSet::ID> url_match_ids; 310 std::set<URLMatcherConditionSet::ID> url_match_ids;
277 311
278 // Test various URLs. 312 // Test various URLs.
279 GURL http_url("http://www.example.com"); 313 GURL http_url("http://www.example.com");
280 net::TestURLRequestContext context; 314 net::TestURLRequestContext context;
281 net::TestURLRequest http_request(http_url, NULL, &context); 315 net::TestURLRequest http_request(http_url, NULL, &context);
282 url_match_ids = matcher.MatchURL(http_url); 316 url_match_ids = matcher.MatchURL(http_url);
283 ASSERT_EQ(1u, url_match_ids.size()); 317 ASSERT_EQ(1u, url_match_ids.size());
(...skipping 18 matching lines...) Expand all
302 // the response header. The Create() method should fail and complain that it is 336 // the response header. The Create() method should fail and complain that it is
303 // impossible that both conditions are fulfilled at the same time. 337 // impossible that both conditions are fulfilled at the same time.
304 TEST(WebRequestConditionTest, ConditionsWithConflictingStages) { 338 TEST(WebRequestConditionTest, ConditionsWithConflictingStages) {
305 // Necessary for TestURLRequest. 339 // Necessary for TestURLRequest.
306 MessageLoop message_loop(MessageLoop::TYPE_IO); 340 MessageLoop message_loop(MessageLoop::TYPE_IO);
307 URLMatcher matcher; 341 URLMatcher matcher;
308 342
309 std::string error; 343 std::string error;
310 scoped_ptr<WebRequestCondition> result; 344 scoped_ptr<WebRequestCondition> result;
311 345
312 DictionaryValue condition_value; 346 std::vector<URLMatcherConditionFactory*> factories;
313 condition_value.SetString(keys::kInstanceTypeKey, keys::kRequestMatcherType); 347 factories.push_back(matcher.condition_factory());
314 348 // The second factory is usually from a different matcher, but in this test
349 // we don't care, since we never use it.
350 factories.push_back(matcher.condition_factory());
315 351
316 // Test error on incompatible application stages for involved attributes. 352 // Test error on incompatible application stages for involved attributes.
317 error.clear(); 353 error.clear();
318 result = WebRequestCondition::Create( 354 result = WebRequestCondition::Create(
319 matcher.condition_factory(), 355 factories,
320 *base::test::ParseJson( 356 *base::test::ParseJson(
321 "{ \n" 357 "{ \n"
322 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n" 358 " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
323 // Pass a JS array with one empty object to each of the header 359 // Pass a JS array with one empty object to each of the header
324 // filters. 360 // filters.
325 " \"requestHeaders\": [{}], \n" 361 " \"requestHeaders\": [{}], \n"
326 " \"responseHeaders\": [{}], \n" 362 " \"responseHeaders\": [{}], \n"
327 "}"), 363 "}"),
328 &error); 364 &error);
329 EXPECT_FALSE(error.empty()); 365 EXPECT_FALSE(error.empty());
330 EXPECT_FALSE(result.get()); 366 EXPECT_FALSE(result.get());
331 } 367 }
332 368
333 } // namespace extensions 369 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698