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.
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"
16 //------------------------------------------------------------------------------
17 // Workaround for http://crbug.com/418975; remove when fixed.
20 //------------------------------------------------------------------------------
21 // Provide sample data and compression results with a sample VCDIFF dictionary.
22 // Note an SDCH dictionary has extra meta-data before the VCDIFF dictionary.
23 static const char kTestVcdiffDictionary[] = "DictionaryFor"
24 "SdchCompression1SdchCompression2SdchCompression3SdchCompression\n";
26 //------------------------------------------------------------------------------
28 class SdchManagerTest : public testing::Test {
31 : sdch_manager_(new SdchManager),
32 default_support_(false),
33 default_https_support_(false) {
34 default_support_ = sdch_manager_->sdch_enabled();
35 default_https_support_ = sdch_manager_->secure_scheme_supported();
38 SdchManager* sdch_manager() { return sdch_manager_.get(); }
40 // Reset globals back to default state.
41 virtual void TearDown() {
42 SdchManager::EnableSdchSupport(default_support_);
43 SdchManager::EnableSecureSchemeSupport(default_https_support_);
46 // Attempt to add a dictionary to the manager and probe for success or
48 bool AddSdchDictionary(const std::string& dictionary_text,
51 sdch_manager_->GetAvailDictionaryList(gurl, &list);
52 sdch_manager_->AddSdchDictionary(dictionary_text, gurl);
54 sdch_manager_->GetAvailDictionaryList(gurl, &list2);
56 // The list of hashes should change iff the addition succeeds.
57 return (list != list2);
61 scoped_ptr<SdchManager> sdch_manager_;
62 bool default_support_;
63 bool default_https_support_;
66 static std::string NewSdchDictionary(const std::string& domain) {
67 std::string dictionary;
68 if (!domain.empty()) {
69 dictionary.append("Domain: ");
70 dictionary.append(domain);
71 dictionary.append("\n");
73 dictionary.append("\n");
74 dictionary.append(kTestVcdiffDictionary, sizeof(kTestVcdiffDictionary) - 1);
78 TEST_F(SdchManagerTest, DomainSupported) {
79 GURL google_url("http://www.google.com");
81 SdchManager::EnableSdchSupport(false);
82 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(google_url));
83 SdchManager::EnableSdchSupport(true);
84 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(google_url));
87 TEST_F(SdchManagerTest, DomainBlacklisting) {
88 GURL test_url("http://www.test.com");
89 GURL google_url("http://www.google.com");
91 sdch_manager()->BlacklistDomain(test_url, SdchManager::MIN_PROBLEM_CODE);
92 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(test_url));
93 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(google_url));
95 sdch_manager()->BlacklistDomain(google_url, SdchManager::MIN_PROBLEM_CODE);
96 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(google_url));
99 TEST_F(SdchManagerTest, DomainBlacklistingCaseSensitivity) {
100 GURL test_url("http://www.TesT.com");
101 GURL test2_url("http://www.tEst.com");
103 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(test_url));
104 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(test2_url));
105 sdch_manager()->BlacklistDomain(test_url, SdchManager::MIN_PROBLEM_CODE);
106 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(test2_url));
109 TEST_F(SdchManagerTest, BlacklistingReset) {
110 GURL gurl("http://mytest.DoMain.com");
111 std::string domain(gurl.host());
113 sdch_manager()->ClearBlacklistings();
114 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), 0);
115 EXPECT_EQ(sdch_manager()->BlacklistDomainExponential(domain), 0);
116 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(gurl));
119 TEST_F(SdchManagerTest, BlacklistingSingleBlacklist) {
120 GURL gurl("http://mytest.DoMain.com");
121 std::string domain(gurl.host());
122 sdch_manager()->ClearBlacklistings();
124 sdch_manager()->BlacklistDomain(gurl, SdchManager::MIN_PROBLEM_CODE);
125 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), 1);
126 EXPECT_EQ(sdch_manager()->BlacklistDomainExponential(domain), 1);
128 // Check that any domain lookup reduces the blacklist counter.
129 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(gurl));
130 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), 0);
131 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(gurl));
134 TEST_F(SdchManagerTest, BlacklistingExponential) {
135 GURL gurl("http://mytest.DoMain.com");
136 std::string domain(gurl.host());
137 sdch_manager()->ClearBlacklistings();
140 for (int i = 1; i < 100; ++i) {
141 sdch_manager()->BlacklistDomain(gurl, SdchManager::MIN_PROBLEM_CODE);
142 EXPECT_EQ(sdch_manager()->BlacklistDomainExponential(domain), exponential);
144 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), exponential);
145 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(gurl));
146 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), exponential - 1);
148 // Simulate a large number of domain checks (which eventually remove the
150 sdch_manager()->ClearDomainBlacklisting(domain);
151 EXPECT_EQ(sdch_manager()->BlackListDomainCount(domain), 0);
152 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(gurl));
154 // Predict what exponential backoff will be.
155 exponential = 1 + 2 * exponential;
157 exponential = INT_MAX; // We don't wrap.
161 TEST_F(SdchManagerTest, CanSetExactMatchDictionary) {
162 std::string dictionary_domain("x.y.z.google.com");
163 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
165 // Perfect match should work.
166 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
167 GURL("http://" + dictionary_domain)));
170 TEST_F(SdchManagerTest, CanAdvertiseDictionaryOverHTTP) {
171 std::string dictionary_domain("x.y.z.google.com");
172 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
174 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
175 GURL("http://" + dictionary_domain)));
177 std::string dictionary_list;
178 // HTTP target URL can advertise dictionary.
179 sdch_manager()->GetAvailDictionaryList(
180 GURL("http://" + dictionary_domain + "/test"),
182 EXPECT_FALSE(dictionary_list.empty());
185 TEST_F(SdchManagerTest, CanNotAdvertiseDictionaryOverHTTPS) {
186 std::string dictionary_domain("x.y.z.google.com");
187 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
189 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
190 GURL("http://" + dictionary_domain)));
192 std::string dictionary_list;
193 // HTTPS target URL should NOT advertise dictionary.
194 sdch_manager()->GetAvailDictionaryList(
195 GURL("https://" + dictionary_domain + "/test"),
197 EXPECT_TRUE(dictionary_list.empty());
200 TEST_F(SdchManagerTest, CanUseHTTPSDictionaryOverHTTPSIfEnabled) {
201 std::string dictionary_domain("x.y.z.google.com");
202 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
204 SdchManager::EnableSecureSchemeSupport(false);
205 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
206 GURL("https://" + dictionary_domain)));
207 SdchManager::EnableSecureSchemeSupport(true);
208 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
209 GURL("https://" + dictionary_domain)));
211 GURL target_url("https://" + dictionary_domain + "/test");
212 std::string dictionary_list;
213 // HTTPS target URL should advertise dictionary if secure scheme support is
215 sdch_manager()->GetAvailDictionaryList(target_url, &dictionary_list);
216 EXPECT_FALSE(dictionary_list.empty());
218 // Dictionary should be available.
219 scoped_refptr<SdchManager::Dictionary> dictionary;
220 std::string client_hash;
221 std::string server_hash;
222 sdch_manager()->GenerateHash(dictionary_text, &client_hash, &server_hash);
223 sdch_manager()->GetVcdiffDictionary(server_hash, target_url, &dictionary);
224 EXPECT_TRUE(dictionary.get() != NULL);
227 TEST_F(SdchManagerTest, CanNotUseHTTPDictionaryOverHTTPS) {
228 std::string dictionary_domain("x.y.z.google.com");
229 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
231 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
232 GURL("http://" + dictionary_domain)));
234 GURL target_url("https://" + dictionary_domain + "/test");
235 std::string dictionary_list;
236 // HTTPS target URL should not advertise dictionary acquired over HTTP even if
237 // secure scheme support is enabled.
238 SdchManager::EnableSecureSchemeSupport(true);
239 sdch_manager()->GetAvailDictionaryList(target_url, &dictionary_list);
240 EXPECT_TRUE(dictionary_list.empty());
242 scoped_refptr<SdchManager::Dictionary> dictionary;
243 std::string client_hash;
244 std::string server_hash;
245 sdch_manager()->GenerateHash(dictionary_text, &client_hash, &server_hash);
246 sdch_manager()->GetVcdiffDictionary(server_hash, target_url, &dictionary);
247 EXPECT_TRUE(dictionary.get() == NULL);
250 TEST_F(SdchManagerTest, CanNotUseHTTPSDictionaryOverHTTP) {
251 std::string dictionary_domain("x.y.z.google.com");
252 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
254 SdchManager::EnableSecureSchemeSupport(true);
255 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
256 GURL("https://" + dictionary_domain)));
258 GURL target_url("http://" + dictionary_domain + "/test");
259 std::string dictionary_list;
260 // HTTP target URL should not advertise dictionary acquired over HTTPS even if
261 // secure scheme support is enabled.
262 sdch_manager()->GetAvailDictionaryList(target_url, &dictionary_list);
263 EXPECT_TRUE(dictionary_list.empty());
265 scoped_refptr<SdchManager::Dictionary> dictionary;
266 std::string client_hash;
267 std::string server_hash;
268 sdch_manager()->GenerateHash(dictionary_text, &client_hash, &server_hash);
269 sdch_manager()->GetVcdiffDictionary(server_hash, target_url, &dictionary);
270 EXPECT_TRUE(dictionary.get() == NULL);
273 TEST_F(SdchManagerTest, FailToSetDomainMismatchDictionary) {
274 std::string dictionary_domain("x.y.z.google.com");
275 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
277 // Fail the "domain match" requirement.
278 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
279 GURL("http://y.z.google.com")));
282 TEST_F(SdchManagerTest, FailToSetDotHostPrefixDomainDictionary) {
283 std::string dictionary_domain("x.y.z.google.com");
284 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
286 // Fail the HD with D being the domain and H having a dot requirement.
287 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
288 GURL("http://w.x.y.z.google.com")));
291 TEST_F(SdchManagerTest, FailToSetDotHostPrefixDomainDictionaryTrailingDot) {
292 std::string dictionary_domain("x.y.z.google.com");
293 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
295 // Fail the HD with D being the domain and H having a dot requirement.
296 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
297 GURL("http://w.x.y.z.google.com.")));
300 TEST_F(SdchManagerTest, FailToSetRepeatPrefixWithDotDictionary) {
301 // Make sure that a prefix that matches the domain postfix won't confuse
302 // the validation checks.
303 std::string dictionary_domain("www.google.com");
304 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
306 // Fail the HD with D being the domain and H having a dot requirement.
307 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
308 GURL("http://www.google.com.www.google.com")));
311 TEST_F(SdchManagerTest, CanSetLeadingDotDomainDictionary) {
312 // Make sure that a prefix that matches the domain postfix won't confuse
313 // the validation checks.
314 std::string dictionary_domain(".google.com");
315 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
317 // Verify that a leading dot in the domain is acceptable, as long as the host
318 // name does not contain any dots preceding the matched domain name.
319 EXPECT_TRUE(AddSdchDictionary(dictionary_text, GURL("http://www.google.com")));
322 TEST_F(SdchManagerTest,
323 CanSetLeadingDotDomainDictionaryFromURLWithTrailingDot) {
324 // Make sure that a prefix that matches the domain postfix won't confuse
325 // the validation checks.
326 std::string dictionary_domain(".google.com");
327 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
329 // Verify that a leading dot in the domain is acceptable, as long as the host
330 // name does not contain any dots preceding the matched domain name.
331 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
332 GURL("http://www.google.com.")));
335 TEST_F(SdchManagerTest, CannotSetLeadingDotDomainDictionary) {
336 // Make sure that a prefix that matches the domain postfix won't confuse
337 // the validation checks.
338 std::string dictionary_domain(".google.com");
339 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
341 // Verify that a leading dot in the domain does not affect the name containing
343 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
344 GURL("http://www.subdomain.google.com")));
347 TEST_F(SdchManagerTest, CannotSetLeadingDotDomainDictionaryTrailingDot) {
348 // Make sure that a prefix that matches the domain postfix won't confuse
349 // the validation checks.
350 std::string dictionary_domain(".google.com");
351 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
353 // Verify that a trailing period in the URL doesn't affect the check.
354 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
355 GURL("http://www.subdomain.google.com.")));
358 // Make sure the order of the tests is not helping us or confusing things.
359 // See test CanSetExactMatchDictionary above for first try.
360 TEST_F(SdchManagerTest, CanStillSetExactMatchDictionary) {
361 std::string dictionary_domain("x.y.z.google.com");
362 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
364 // Perfect match should *STILL* work.
365 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
366 GURL("http://" + dictionary_domain)));
369 // Make sure the DOS protection precludes the addition of too many dictionaries.
370 TEST_F(SdchManagerTest, TooManyDictionaries) {
371 std::string dictionary_domain(".google.com");
372 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
374 for (size_t count = 0; count < SdchManager::kMaxDictionaryCount; ++count) {
375 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
376 GURL("http://www.google.com")));
377 dictionary_text += " "; // Create dictionary with different SHA signature.
380 AddSdchDictionary(dictionary_text, GURL("http://www.google.com")));
383 TEST_F(SdchManagerTest, DictionaryNotTooLarge) {
384 std::string dictionary_domain(".google.com");
385 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
387 dictionary_text.append(
388 SdchManager::kMaxDictionarySize - dictionary_text.size(), ' ');
389 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
390 GURL("http://" + dictionary_domain)));
393 TEST_F(SdchManagerTest, DictionaryTooLarge) {
394 std::string dictionary_domain(".google.com");
395 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
397 dictionary_text.append(
398 SdchManager::kMaxDictionarySize + 1 - dictionary_text.size(), ' ');
399 EXPECT_FALSE(AddSdchDictionary(dictionary_text,
400 GURL("http://" + dictionary_domain)));
403 TEST_F(SdchManagerTest, PathMatch) {
404 bool (*PathMatch)(const std::string& path, const std::string& restriction) =
405 SdchManager::Dictionary::PathMatch;
406 // Perfect match is supported.
407 EXPECT_TRUE(PathMatch("/search", "/search"));
408 EXPECT_TRUE(PathMatch("/search/", "/search/"));
410 // Prefix only works if last character of restriction is a slash, or first
411 // character in path after a match is a slash. Validate each case separately.
413 // Rely on the slash in the path (not at the end of the restriction).
414 EXPECT_TRUE(PathMatch("/search/something", "/search"));
415 EXPECT_TRUE(PathMatch("/search/s", "/search"));
416 EXPECT_TRUE(PathMatch("/search/other", "/search"));
417 EXPECT_TRUE(PathMatch("/search/something", "/search"));
419 // Rely on the slash at the end of the restriction.
420 EXPECT_TRUE(PathMatch("/search/something", "/search/"));
421 EXPECT_TRUE(PathMatch("/search/s", "/search/"));
422 EXPECT_TRUE(PathMatch("/search/other", "/search/"));
423 EXPECT_TRUE(PathMatch("/search/something", "/search/"));
425 // Make sure less that sufficient prefix match is false.
426 EXPECT_FALSE(PathMatch("/sear", "/search"));
427 EXPECT_FALSE(PathMatch("/", "/search"));
428 EXPECT_FALSE(PathMatch(std::string(), "/search"));
430 // Add examples with several levels of direcories in the restriction.
431 EXPECT_FALSE(PathMatch("/search/something", "search/s"));
432 EXPECT_FALSE(PathMatch("/search/", "/search/s"));
434 // Make sure adding characters to path will also fail.
435 EXPECT_FALSE(PathMatch("/searching", "/search/"));
436 EXPECT_FALSE(PathMatch("/searching", "/search"));
438 // Make sure we're case sensitive.
439 EXPECT_FALSE(PathMatch("/ABC", "/abc"));
440 EXPECT_FALSE(PathMatch("/abc", "/ABC"));
443 // The following are only applicable while we have a latency test in the code,
444 // and can be removed when that functionality is stripped.
445 TEST_F(SdchManagerTest, LatencyTestControls) {
446 GURL url("http://www.google.com");
447 GURL url2("http://www.google2.com");
449 // First make sure we default to false.
450 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url));
451 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url2));
453 // That we can set each to true.
454 sdch_manager()->SetAllowLatencyExperiment(url, true);
455 EXPECT_TRUE(sdch_manager()->AllowLatencyExperiment(url));
456 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url2));
458 sdch_manager()->SetAllowLatencyExperiment(url2, true);
459 EXPECT_TRUE(sdch_manager()->AllowLatencyExperiment(url));
460 EXPECT_TRUE(sdch_manager()->AllowLatencyExperiment(url2));
462 // And can reset them to false.
463 sdch_manager()->SetAllowLatencyExperiment(url, false);
464 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url));
465 EXPECT_TRUE(sdch_manager()->AllowLatencyExperiment(url2));
467 sdch_manager()->SetAllowLatencyExperiment(url2, false);
468 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url));
469 EXPECT_FALSE(sdch_manager()->AllowLatencyExperiment(url2));
472 TEST_F(SdchManagerTest, CanUseMultipleManagers) {
473 SdchManager second_manager;
475 std::string dictionary_domain_1("x.y.z.google.com");
476 std::string dictionary_domain_2("x.y.z.chromium.org");
478 std::string dictionary_text_1(NewSdchDictionary(dictionary_domain_1));
479 std::string dictionary_text_2(NewSdchDictionary(dictionary_domain_2));
481 std::string tmp_hash;
482 std::string server_hash_1;
483 std::string server_hash_2;
485 SdchManager::GenerateHash(dictionary_text_1, &tmp_hash, &server_hash_1);
486 SdchManager::GenerateHash(dictionary_text_2, &tmp_hash, &server_hash_2);
488 // Confirm that if you add directories to one manager, you
489 // can't get them from the other.
490 EXPECT_TRUE(AddSdchDictionary(dictionary_text_1,
491 GURL("http://" + dictionary_domain_1)));
492 scoped_refptr<SdchManager::Dictionary> dictionary;
493 sdch_manager()->GetVcdiffDictionary(
495 GURL("http://" + dictionary_domain_1 + "/random_url"),
497 EXPECT_TRUE(dictionary.get());
499 second_manager.AddSdchDictionary(
500 dictionary_text_2, GURL("http://" + dictionary_domain_2));
501 second_manager.GetVcdiffDictionary(
503 GURL("http://" + dictionary_domain_2 + "/random_url"),
505 EXPECT_TRUE(dictionary.get());
507 sdch_manager()->GetVcdiffDictionary(
509 GURL("http://" + dictionary_domain_2 + "/random_url"),
511 EXPECT_FALSE(dictionary.get());
513 second_manager.GetVcdiffDictionary(
515 GURL("http://" + dictionary_domain_1 + "/random_url"),
517 EXPECT_FALSE(dictionary.get());
520 TEST_F(SdchManagerTest, HttpsCorrectlySupported) {
521 GURL url("http://www.google.com");
522 GURL secure_url("https://www.google.com");
525 // Workaround for http://crbug.com/418975; remove when fixed.
526 bool expect_https_support = true;
528 bool expect_https_support = false;
531 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url));
532 EXPECT_EQ(expect_https_support,
533 sdch_manager()->IsInSupportedDomain(secure_url));
535 SdchManager::EnableSecureSchemeSupport(!expect_https_support);
536 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url));
537 EXPECT_NE(expect_https_support,
538 sdch_manager()->IsInSupportedDomain(secure_url));
541 TEST_F(SdchManagerTest, ClearDictionaryData) {
542 std::string dictionary_domain("x.y.z.google.com");
543 GURL blacklist_url("http://bad.chromium.org");
545 std::string dictionary_text(NewSdchDictionary(dictionary_domain));
546 std::string tmp_hash;
547 std::string server_hash;
549 SdchManager::GenerateHash(dictionary_text, &tmp_hash, &server_hash);
551 EXPECT_TRUE(AddSdchDictionary(dictionary_text,
552 GURL("http://" + dictionary_domain)));
553 scoped_refptr<SdchManager::Dictionary> dictionary;
554 sdch_manager()->GetVcdiffDictionary(
556 GURL("http://" + dictionary_domain + "/random_url"),
558 EXPECT_TRUE(dictionary.get());
560 sdch_manager()->BlacklistDomain(GURL(blacklist_url),
561 SdchManager::MIN_PROBLEM_CODE);
562 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(blacklist_url));
564 sdch_manager()->ClearData();
567 sdch_manager()->GetVcdiffDictionary(
569 GURL("http://" + dictionary_domain + "/random_url"),
571 EXPECT_FALSE(dictionary.get());
572 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(blacklist_url));
577 TEST(SdchManagerTest, SdchOffByDefault) {
578 GURL google_url("http://www.google.com");
579 SdchManager* sdch_manager(new SdchManager);
581 EXPECT_FALSE(sdch_manager->IsInSupportedDomain(google_url));
582 SdchManager::EnableSdchSupport(true);
583 EXPECT_TRUE(sdch_manager->IsInSupportedDomain(google_url));
586 #endif // !defined(OS_IOS)