Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 <limits.h> | 5 #include <limits.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 GURL secure_url("https://www.google.com"); | 434 GURL secure_url("https://www.google.com"); |
| 435 | 435 |
| 436 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url)); | 436 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url)); |
| 437 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(secure_url)); | 437 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(secure_url)); |
| 438 | 438 |
| 439 SdchManager::EnableSecureSchemeSupport(true); | 439 SdchManager::EnableSecureSchemeSupport(true); |
| 440 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url)); | 440 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(url)); |
| 441 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(secure_url)); | 441 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(secure_url)); |
| 442 } | 442 } |
| 443 | 443 |
| 444 TEST_F(SdchManagerTest, ClearDictionaryData) { | |
| 445 std::string dictionary_domain("x.y.z.google.com"); | |
| 446 GURL blacklist_url("http://bad.chromium.org"); | |
| 447 | |
| 448 std::string dictionary_text(NewSdchDictionary(dictionary_domain)); | |
| 449 std::string tmp_hash; | |
| 450 std::string server_hash; | |
| 451 | |
| 452 SdchManager::GenerateHash(dictionary_text, &tmp_hash, &server_hash); | |
| 453 | |
| 454 EXPECT_TRUE(sdch_manager()->AddSdchDictionary( | |
| 455 dictionary_text, GURL("http://" + dictionary_domain))); | |
| 456 SdchManager::Dictionary* dictionary = NULL; | |
| 457 sdch_manager()->GetVcdiffDictionary( | |
| 458 server_hash, | |
| 459 GURL("http://" + dictionary_domain + "/random_url"), | |
| 460 &dictionary); | |
| 461 EXPECT_TRUE(dictionary); | |
| 462 | |
| 463 sdch_manager()->BlacklistDomain(GURL(blacklist_url)); | |
| 464 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(blacklist_url)); | |
| 465 | |
| 466 sdch_manager()->ClearData(); | |
|
jar (doing other things)
2014/06/17 05:48:55
This is probably the line of code that was critica
Randy Smith (Not in Mondays)
2014/06/17 18:33:11
Done.
| |
| 467 | |
| 468 dictionary = NULL; | |
| 469 sdch_manager()->GetVcdiffDictionary( | |
| 470 server_hash, | |
| 471 GURL("http://" + dictionary_domain + "/random_url"), | |
| 472 &dictionary); | |
| 473 EXPECT_FALSE(dictionary); | |
| 474 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(blacklist_url)); | |
| 475 } | |
| 476 | |
| 444 } // namespace net | 477 } // namespace net |
| 445 | 478 |
| OLD | NEW |