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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 &dictionary); | 414 &dictionary); |
415 EXPECT_FALSE(dictionary); | 415 EXPECT_FALSE(dictionary); |
416 | 416 |
417 second_manager->GetVcdiffDictionary( | 417 second_manager->GetVcdiffDictionary( |
418 server_hash_1, | 418 server_hash_1, |
419 GURL("http://" + dictionary_domain_1 + "/random_url"), | 419 GURL("http://" + dictionary_domain_1 + "/random_url"), |
420 &dictionary); | 420 &dictionary); |
421 EXPECT_FALSE(dictionary); | 421 EXPECT_FALSE(dictionary); |
422 } | 422 } |
423 | 423 |
| 424 TEST_F(SdchManagerTest, ClearDictionaryData) { |
| 425 std::string dictionary_domain("x.y.z.google.com"); |
| 426 GURL blacklist_url("http://bad.chromium.org"); |
| 427 |
| 428 std::string dictionary_text(NewSdchDictionary(dictionary_domain)); |
| 429 std::string tmp_hash; |
| 430 std::string server_hash; |
| 431 |
| 432 SdchManager::GenerateHash(dictionary_text, &tmp_hash, &server_hash); |
| 433 |
| 434 EXPECT_TRUE(sdch_manager()->AddSdchDictionary( |
| 435 dictionary_text, GURL("http://" + dictionary_domain))); |
| 436 SdchManager::Dictionary* dictionary = NULL; |
| 437 sdch_manager()->GetVcdiffDictionary( |
| 438 server_hash, |
| 439 GURL("http://" + dictionary_domain + "/random_url"), |
| 440 &dictionary); |
| 441 EXPECT_TRUE(dictionary); |
| 442 |
| 443 sdch_manager()->BlacklistDomain(GURL(blacklist_url)); |
| 444 EXPECT_FALSE(sdch_manager()->IsInSupportedDomain(blacklist_url)); |
| 445 |
| 446 sdch_manager()->ClearData(); |
| 447 |
| 448 dictionary = NULL; |
| 449 sdch_manager()->GetVcdiffDictionary( |
| 450 server_hash, |
| 451 GURL("http://" + dictionary_domain + "/random_url"), |
| 452 &dictionary); |
| 453 EXPECT_FALSE(dictionary); |
| 454 EXPECT_TRUE(sdch_manager()->IsInSupportedDomain(blacklist_url)); |
| 455 } |
| 456 |
424 } // namespace net | 457 } // namespace net |
425 | 458 |
OLD | NEW |