Chromecast Android buildfix: rework CommandLine initialization logic.
[chromium-blink-merge.git] / net / base / sdch_manager_unittest.cc
blobf6d44bebb8595cdebfb93475044423143f4f3c94
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include <limits.h>
7 #include <string>
9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/sdch_manager.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 namespace net {
16 //------------------------------------------------------------------------------
17 // Provide sample data and compression results with a sample VCDIFF dictionary.
18 // Note an SDCH dictionary has extra meta-data before the VCDIFF dictionary.
19 static const char kTestVcdiffDictionary[] = "DictionaryFor"
20 "SdchCompression1SdchCompression2SdchCompression3SdchCompression\n";
22 //------------------------------------------------------------------------------
24 class SdchManagerTest : public testing::Test {
25 protected:
26 SdchManagerTest()
27 : sdch_manager_(new SdchManager),
28 default_support_(false),
29 default_https_support_(false) {
30 default_support_ = sdch_manager_->sdch_enabled();
31 default_https_support_ = sdch_manager_->secure_scheme_supported();
34 SdchManager* sdch_manager() { return sdch_manager_.get(); }
36 // Reset globals back to default state.
37 virtual void TearDown() {
38 SdchManager::EnableSdchSupport(default_support_);
39 SdchManager::EnableSecureSchemeSupport(default_https_support_);
42 // Attempt to add a dictionary to the manager and probe for success or
43 // failure.
44 bool AddSdchDictionary(const std::string& dictionary_text,
45 const GURL& gurl) {
46 std::string list;
47 sdch_manager_->GetAvailDictionaryList(gurl, &list);
48 sdch_manager_->AddSdchDictionary(dictionary_text, gurl);
49 std::string list2;
50 sdch_manager_->GetAvailDictionaryList(gurl, &list2);
52 // The list of hashes should change iff the addition succeeds.
53 return (list != list2);
56 private:
57 scoped_ptr<SdchManager> sdch_manager_;
58 bool default_support_;
59 bool default_https_support_;
62 //------------------------------------------------------------------------------
63 static std::string NewSdchDictionary(const std::string& domain) {
64 std::string dictionary;
65 if (!domain.empty()) {
66 dictionary.append("Domain: ");
67 dictionary.append(domain);
68 dictionary.append("\n");
70 dictionary.append("\n");
71 dictionary.append(kTestVcdiffDictionary, sizeof(kTestVcdiffDictionary) - 1);
72 return dictionary;
75 TEST_F(SdchManagerTest, DomainSupported) {
76 GURL google_url("http://www.google.com");
78 SdchManager::EnableSdchSupport(false);
79 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(google_url));
80 SdchManager::EnableSdchSupport(true);
81 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(google_url));
84 TEST_F(SdchManagerTest, DomainBlacklisting) {
85 GURL test_url("http://www.test.com");
86 GURL google_url("http://www.google.com");
88 sdch_manager()->BlacklistDomain(test_url, SdchManager::MIN_PROBLEM_CODE);
89 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(test_url));
90 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(google_url));
92 sdch_manager()->BlacklistDomain(google_url, SdchManager::MIN_PROBLEM_CODE);
93 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(google_url));
96 TEST_F(SdchManagerTest, DomainBlacklistingCaseSensitivity) {
97 GURL test_url("http://www.TesT.com");
98 GURL test2_url("http://www.tEst.com");
100 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(test_url));
101 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(test2_url));
102 sdch_manager()->BlacklistDomain(test_url, SdchManager::MIN_PROBLEM_CODE);
103 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(test2_url));
106 TEST_F(SdchManagerTest, BlacklistingReset) {
107 GURL gurl("http://mytest.DoMain.com");
108 std::string domain(gurl.host());
110 sdch_manager()->ClearBlacklistings();
111 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), 0);
112 EXPECT_EQ(sdch_manager()->BlacklistDomainExponential(domain), 0);
113 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(gurl));
116 TEST_F(SdchManagerTest, BlacklistingSingleBlacklist) {
117 GURL gurl("http://mytest.DoMain.com");
118 std::string domain(gurl.host());
119 sdch_manager()->ClearBlacklistings();
121 sdch_manager()->BlacklistDomain(gurl, SdchManager::MIN_PROBLEM_CODE);
122 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), 1);
123 EXPECT_EQ(sdch_manager()->BlacklistDomainExponential(domain), 1);
125 // Check that any domain lookup reduces the blacklist counter.
126 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(gurl));
127 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), 0);
128 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(gurl));
131 TEST_F(SdchManagerTest, BlacklistingExponential) {
132 GURL gurl("http://mytest.DoMain.com");
133 std::string domain(gurl.host());
134 sdch_manager()->ClearBlacklistings();
136 int exponential = 1;
137 for (int i = 1; i < 100; ++i) {
138 sdch_manager()->BlacklistDomain(gurl, SdchManager::MIN_PROBLEM_CODE);
139 EXPECT_EQ(sdch_manager()->BlacklistDomainExponential(domain), exponential);
141 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), exponential);
142 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(gurl));
143 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), exponential - 1);
145 // Simulate a large number of domain checks (which eventually remove the
146 // blacklisting).
147 sdch_manager()->ClearDomainBlacklisting(domain);
148 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), 0);
149 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(gurl));
151 // Predict what exponential backoff will be.
152 exponential = 1 + 2 * exponential;
153 if (exponential < 0)
154 exponential = INT_MAX; // We don't wrap.
158 TEST_F(SdchManagerTest, CanSetExactMatchDictionary) {
159 std::string dictionary_domain("x.y.z.google.com");
160 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
162 // Perfect match should work.
163 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
164 GURL("http://" + dictionary_domain)));
167 TEST_F(SdchManagerTest, CanAdvertiseDictionaryOverHTTP) {
168 std::string dictionary_domain("x.y.z.google.com");
169 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
171 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
172 GURL("http://" + dictionary_domain)));
174 std::string dictionary_list;
175 // HTTP target URL can advertise dictionary.
176 sdch_manager()->GetAvailDictionaryList(
177 GURL("http://" + dictionary_domain + "/test"),
178 &dictionary_list);
179 EXPECT_FALSE(dictionary_list.empty());
182 TEST_F(SdchManagerTest, CanNotAdvertiseDictionaryOverHTTPS) {
183 std::string dictionary_domain("x.y.z.google.com");
184 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
186 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
187 GURL("http://" + dictionary_domain)));
189 std::string dictionary_list;
190 // HTTPS target URL should NOT advertise dictionary.
191 sdch_manager()->GetAvailDictionaryList(
192 GURL("https://" + dictionary_domain + "/test"),
193 &dictionary_list);
194 EXPECT_TRUE(dictionary_list.empty());
197 TEST_F(SdchManagerTest, CanUseHTTPSDictionaryOverHTTPSIfEnabled) {
198 std::string dictionary_domain("x.y.z.google.com");
199 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
201 SdchManager::EnableSecureSchemeSupport(false);
202 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
203 GURL("https://" + dictionary_domain)));
204 SdchManager::EnableSecureSchemeSupport(true);
205 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
206 GURL("https://" + dictionary_domain)));
208 GURL target_url("https://" + dictionary_domain + "/test");
209 std::string dictionary_list;
210 // HTTPS target URL should advertise dictionary if secure scheme support is
211 // enabled.
212 sdch_manager()->GetAvailDictionaryList(target_url, &dictionary_list);
213 EXPECT_FALSE(dictionary_list.empty());
215 // Dictionary should be available.
216 scoped_refptr<SdchManager::Dictionary> dictionary;
217 std::string client_hash;
218 std::string server_hash;
219 sdch_manager()->GenerateHash(dictionary_text, &client_hash, &server_hash);
220 sdch_manager()->GetVcdiffDictionary(server_hash, target_url, &dictionary);
221 EXPECT_TRUE(dictionary.get() != NULL);
224 TEST_F(SdchManagerTest, CanNotUseHTTPDictionaryOverHTTPS) {
225 std::string dictionary_domain("x.y.z.google.com");
226 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
228 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
229 GURL("http://" + dictionary_domain)));
231 GURL target_url("https://" + dictionary_domain + "/test");
232 std::string dictionary_list;
233 // HTTPS target URL should not advertise dictionary acquired over HTTP even if
234 // secure scheme support is enabled.
235 SdchManager::EnableSecureSchemeSupport(true);
236 sdch_manager()->GetAvailDictionaryList(target_url, &dictionary_list);
237 EXPECT_TRUE(dictionary_list.empty());
239 scoped_refptr<SdchManager::Dictionary> dictionary;
240 std::string client_hash;
241 std::string server_hash;
242 sdch_manager()->GenerateHash(dictionary_text, &client_hash, &server_hash);
243 sdch_manager()->GetVcdiffDictionary(server_hash, target_url, &dictionary);
244 EXPECT_TRUE(dictionary.get() == NULL);
247 TEST_F(SdchManagerTest, CanNotUseHTTPSDictionaryOverHTTP) {
248 std::string dictionary_domain("x.y.z.google.com");
249 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
251 SdchManager::EnableSecureSchemeSupport(true);
252 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
253 GURL("https://" + dictionary_domain)));
255 GURL target_url("http://" + dictionary_domain + "/test");
256 std::string dictionary_list;
257 // HTTP target URL should not advertise dictionary acquired over HTTPS even if
258 // secure scheme support is enabled.
259 sdch_manager()->GetAvailDictionaryList(target_url, &dictionary_list);
260 EXPECT_TRUE(dictionary_list.empty());
262 scoped_refptr<SdchManager::Dictionary> dictionary;
263 std::string client_hash;
264 std::string server_hash;
265 sdch_manager()->GenerateHash(dictionary_text, &client_hash, &server_hash);
266 sdch_manager()->GetVcdiffDictionary(server_hash, target_url, &dictionary);
267 EXPECT_TRUE(dictionary.get() == NULL);
270 TEST_F(SdchManagerTest, FailToSetDomainMismatchDictionary) {
271 std::string dictionary_domain("x.y.z.google.com");
272 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
274 // Fail the "domain match" requirement.
275 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
276 GURL("http://y.z.google.com")));
279 TEST_F(SdchManagerTest, FailToSetDotHostPrefixDomainDictionary) {
280 std::string dictionary_domain("x.y.z.google.com");
281 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
283 // Fail the HD with D being the domain and H having a dot requirement.
284 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
285 GURL("http://w.x.y.z.google.com")));
288 TEST_F(SdchManagerTest, FailToSetDotHostPrefixDomainDictionaryTrailingDot) {
289 std::string dictionary_domain("x.y.z.google.com");
290 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
292 // Fail the HD with D being the domain and H having a dot requirement.
293 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
294 GURL("http://w.x.y.z.google.com.")));
297 TEST_F(SdchManagerTest, FailToSetRepeatPrefixWithDotDictionary) {
298 // Make sure that a prefix that matches the domain postfix won't confuse
299 // the validation checks.
300 std::string dictionary_domain("www.google.com");
301 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
303 // Fail the HD with D being the domain and H having a dot requirement.
304 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
305 GURL("http://www.google.com.www.google.com")));
308 TEST_F(SdchManagerTest, CanSetLeadingDotDomainDictionary) {
309 // Make sure that a prefix that matches the domain postfix won't confuse
310 // the validation checks.
311 std::string dictionary_domain(".google.com");
312 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
314 // Verify that a leading dot in the domain is acceptable, as long as the host
315 // name does not contain any dots preceding the matched domain name.
316 EXPECT_TRUE(AddSdchDictionary(dictionary_text, GURL("http://www.google.com")));
319 TEST_F(SdchManagerTest,
320 CanSetLeadingDotDomainDictionaryFromURLWithTrailingDot) {
321 // Make sure that a prefix that matches the domain postfix won't confuse
322 // the validation checks.
323 std::string dictionary_domain(".google.com");
324 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
326 // Verify that a leading dot in the domain is acceptable, as long as the host
327 // name does not contain any dots preceding the matched domain name.
328 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
329 GURL("http://www.google.com.")));
332 TEST_F(SdchManagerTest, CannotSetLeadingDotDomainDictionary) {
333 // Make sure that a prefix that matches the domain postfix won't confuse
334 // the validation checks.
335 std::string dictionary_domain(".google.com");
336 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
338 // Verify that a leading dot in the domain does not affect the name containing
339 // dots failure.
340 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
341 GURL("http://www.subdomain.google.com")));
344 TEST_F(SdchManagerTest, CannotSetLeadingDotDomainDictionaryTrailingDot) {
345 // Make sure that a prefix that matches the domain postfix won't confuse
346 // the validation checks.
347 std::string dictionary_domain(".google.com");
348 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
350 // Verify that a trailing period in the URL doesn't affect the check.
351 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
352 GURL("http://www.subdomain.google.com.")));
355 // Make sure the order of the tests is not helping us or confusing things.
356 // See test CanSetExactMatchDictionary above for first try.
357 TEST_F(SdchManagerTest, CanStillSetExactMatchDictionary) {
358 std::string dictionary_domain("x.y.z.google.com");
359 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
361 // Perfect match should *STILL* work.
362 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
363 GURL("http://" + dictionary_domain)));
366 // Make sure the DOS protection precludes the addition of too many dictionaries.
367 TEST_F(SdchManagerTest, TooManyDictionaries) {
368 std::string dictionary_domain(".google.com");
369 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
371 for (size_t count = 0; count < SdchManager::kMaxDictionaryCount; ++count) {
372 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
373 GURL("http://www.google.com")));
374 dictionary_text += " "; // Create dictionary with different SHA signature.
376 EXPECT_FALSE(
377 AddSdchDictionary(dictionary_text, GURL("http://www.google.com")));
380 TEST_F(SdchManagerTest, DictionaryNotTooLarge) {
381 std::string dictionary_domain(".google.com");
382 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
384 dictionary_text.append(
385 SdchManager::kMaxDictionarySize - dictionary_text.size(), ' ');
386 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
387 GURL("http://" + dictionary_domain)));
390 TEST_F(SdchManagerTest, DictionaryTooLarge) {
391 std::string dictionary_domain(".google.com");
392 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
394 dictionary_text.append(
395 SdchManager::kMaxDictionarySize + 1 - dictionary_text.size(), ' ');
396 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
397 GURL("http://" + dictionary_domain)));
400 TEST_F(SdchManagerTest, PathMatch) {
401 bool (*PathMatch)(const std::string& path, const std::string& restriction) =
402 SdchManager::Dictionary::PathMatch;
403 // Perfect match is supported.
404 EXPECT_TRUE(PathMatch("/search", "/search"));
405 EXPECT_TRUE(PathMatch("/search/", "/search/"));
407 // Prefix only works if last character of restriction is a slash, or first
408 // character in path after a match is a slash. Validate each case separately.
410 // Rely on the slash in the path (not at the end of the restriction).
411 EXPECT_TRUE(PathMatch("/search/something", "/search"));
412 EXPECT_TRUE(PathMatch("/search/s", "/search"));
413 EXPECT_TRUE(PathMatch("/search/other", "/search"));
414 EXPECT_TRUE(PathMatch("/search/something", "/search"));
416 // Rely on the slash at the end of the restriction.
417 EXPECT_TRUE(PathMatch("/search/something", "/search/"));
418 EXPECT_TRUE(PathMatch("/search/s", "/search/"));
419 EXPECT_TRUE(PathMatch("/search/other", "/search/"));
420 EXPECT_TRUE(PathMatch("/search/something", "/search/"));
422 // Make sure less that sufficient prefix match is false.
423 EXPECT_FALSE(PathMatch("/sear", "/search"));
424 EXPECT_FALSE(PathMatch("/", "/search"));
425 EXPECT_FALSE(PathMatch(std::string(), "/search"));
427 // Add examples with several levels of direcories in the restriction.
428 EXPECT_FALSE(PathMatch("/search/something", "search/s"));
429 EXPECT_FALSE(PathMatch("/search/", "/search/s"));
431 // Make sure adding characters to path will also fail.
432 EXPECT_FALSE(PathMatch("/searching", "/search/"));
433 EXPECT_FALSE(PathMatch("/searching", "/search"));
435 // Make sure we're case sensitive.
436 EXPECT_FALSE(PathMatch("/ABC", "/abc"));
437 EXPECT_FALSE(PathMatch("/abc", "/ABC"));
440 // The following are only applicable while we have a latency test in the code,
441 // and can be removed when that functionality is stripped.
442 TEST_F(SdchManagerTest, LatencyTestControls) {
443 GURL url("http://www.google.com");
444 GURL url2("http://www.google2.com");
446 // First make sure we default to false.
447 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url));
448 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url2));
450 // That we can set each to true.
451 sdch_manager()->SetAllowLatencyExperiment(url, true);
452 EXPECT_TRUE(sdch_manager()->AllowLatencyExperiment(url));
453 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url2));
455 sdch_manager()->SetAllowLatencyExperiment(url2, true);
456 EXPECT_TRUE(sdch_manager()->AllowLatencyExperiment(url));
457 EXPECT_TRUE(sdch_manager()->AllowLatencyExperiment(url2));
459 // And can reset them to false.
460 sdch_manager()->SetAllowLatencyExperiment(url, false);
461 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url));
462 EXPECT_TRUE(sdch_manager()->AllowLatencyExperiment(url2));
464 sdch_manager()->SetAllowLatencyExperiment(url2, false);
465 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url));
466 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url2));
469 TEST_F(SdchManagerTest, CanUseMultipleManagers) {
470 SdchManager second_manager;
472 std::string dictionary_domain_1("x.y.z.google.com");
473 std::string dictionary_domain_2("x.y.z.chromium.org");
475 std::string dictionary_text_1(NewSdchDictionary(dictionary_domain_1));
476 std::string dictionary_text_2(NewSdchDictionary(dictionary_domain_2));
478 std::string tmp_hash;
479 std::string server_hash_1;
480 std::string server_hash_2;
482 SdchManager::GenerateHash(dictionary_text_1, &tmp_hash, &server_hash_1);
483 SdchManager::GenerateHash(dictionary_text_2, &tmp_hash, &server_hash_2);
485 // Confirm that if you add directories to one manager, you
486 // can't get them from the other.
487 EXPECT_TRUE(AddSdchDictionary(dictionary_text_1,
488 GURL("http://" + dictionary_domain_1)));
489 scoped_refptr<SdchManager::Dictionary> dictionary;
490 sdch_manager()->GetVcdiffDictionary(
491 server_hash_1,
492 GURL("http://" + dictionary_domain_1 + "/random_url"),
493 &dictionary);
494 EXPECT_TRUE(dictionary.get());
496 second_manager.AddSdchDictionary(
497 dictionary_text_2, GURL("http://" + dictionary_domain_2));
498 second_manager.GetVcdiffDictionary(
499 server_hash_2,
500 GURL("http://" + dictionary_domain_2 + "/random_url"),
501 &dictionary);
502 EXPECT_TRUE(dictionary.get());
504 sdch_manager()->GetVcdiffDictionary(
505 server_hash_2,
506 GURL("http://" + dictionary_domain_2 + "/random_url"),
507 &dictionary);
508 EXPECT_FALSE(dictionary.get());
510 second_manager.GetVcdiffDictionary(
511 server_hash_1,
512 GURL("http://" + dictionary_domain_1 + "/random_url"),
513 &dictionary);
514 EXPECT_FALSE(dictionary.get());
517 TEST_F(SdchManagerTest, HttpsCorrectlySupported) {
518 GURL url("http://www.google.com");
519 GURL secure_url("https://www.google.com");
521 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url));
522 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(secure_url));
524 SdchManager::EnableSecureSchemeSupport(false);
525 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url));
526 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(secure_url));
529 TEST_F(SdchManagerTest, ClearDictionaryData) {
530 std::string dictionary_domain("x.y.z.google.com");
531 GURL blacklist_url("http://bad.chromium.org");
533 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
534 std::string tmp_hash;
535 std::string server_hash;
537 SdchManager::GenerateHash(dictionary_text, &tmp_hash, &server_hash);
539 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
540 GURL("http://" + dictionary_domain)));
541 scoped_refptr<SdchManager::Dictionary> dictionary;
542 sdch_manager()->GetVcdiffDictionary(
543 server_hash,
544 GURL("http://" + dictionary_domain + "/random_url"),
545 &dictionary);
546 EXPECT_TRUE(dictionary.get());
548 sdch_manager()->BlacklistDomain(GURL(blacklist_url),
549 SdchManager::MIN_PROBLEM_CODE);
550 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(blacklist_url));
552 sdch_manager()->ClearData();
554 dictionary = NULL;
555 sdch_manager()->GetVcdiffDictionary(
556 server_hash,
557 GURL("http://" + dictionary_domain + "/random_url"),
558 &dictionary);
559 EXPECT_FALSE(dictionary.get());
560 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(blacklist_url));
563 } // namespace net