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/macros.h" | 10 #include "base/macros.h" |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 kTestVcdiffDictionary, sizeof(kTestVcdiffDictionary) - 1); | 562 kTestVcdiffDictionary, sizeof(kTestVcdiffDictionary) - 1); |
563 std::string client_hash; | 563 std::string client_hash; |
564 std::string server_hash; | 564 std::string server_hash; |
565 SdchManager::GenerateHash(dictionary_text, &client_hash, &server_hash); | 565 SdchManager::GenerateHash(dictionary_text, &client_hash, &server_hash); |
566 GURL target_gurl("http://" + dictionary_domain); | 566 GURL target_gurl("http://" + dictionary_domain); |
567 AddSdchDictionary(dictionary_text, target_gurl); | 567 AddSdchDictionary(dictionary_text, target_gurl); |
568 | 568 |
569 // It should be visible if looked up by hash whether expired or not. | 569 // It should be visible if looked up by hash whether expired or not. |
570 SdchProblemCode problem_code; | 570 SdchProblemCode problem_code; |
571 scoped_ptr<SdchManager::DictionarySet> hash_set( | 571 scoped_ptr<SdchManager::DictionarySet> hash_set( |
572 sdch_manager()->GetDictionarySetByHash( | 572 sdch_manager()->GetDictionarySetByHash(target_gurl, server_hash, |
573 target_gurl, server_hash, &problem_code).Pass()); | 573 &problem_code)); |
574 ASSERT_TRUE(hash_set); | 574 ASSERT_TRUE(hash_set); |
575 ASSERT_EQ(SDCH_OK, problem_code); | 575 ASSERT_EQ(SDCH_OK, problem_code); |
576 | 576 |
577 // Make sure it's not visible for advertisement, but is visible | 577 // Make sure it's not visible for advertisement, but is visible |
578 // if looked up by hash. | 578 // if looked up by hash. |
579 EXPECT_FALSE(sdch_manager()->GetDictionarySet(target_gurl)); | 579 EXPECT_FALSE(sdch_manager()->GetDictionarySet(target_gurl)); |
580 EXPECT_TRUE(sdch_manager()->GetDictionarySetByHash( | 580 EXPECT_TRUE(sdch_manager()->GetDictionarySetByHash( |
581 target_gurl, server_hash, &problem_code)); | 581 target_gurl, server_hash, &problem_code)); |
582 EXPECT_EQ(SDCH_OK, problem_code); | 582 EXPECT_EQ(SDCH_OK, problem_code); |
583 } | 583 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 EXPECT_EQ(server_hash, observer.last_server_hash()); | 626 EXPECT_EQ(server_hash, observer.last_server_hash()); |
627 | 627 |
628 EXPECT_EQ(SDCH_OK, sdch_manager()->RemoveSdchDictionary(server_hash)); | 628 EXPECT_EQ(SDCH_OK, sdch_manager()->RemoveSdchDictionary(server_hash)); |
629 EXPECT_EQ(1, observer.dictionary_removed_notifications()); | 629 EXPECT_EQ(1, observer.dictionary_removed_notifications()); |
630 EXPECT_EQ(server_hash, observer.last_server_hash()); | 630 EXPECT_EQ(server_hash, observer.last_server_hash()); |
631 | 631 |
632 sdch_manager()->RemoveObserver(&observer); | 632 sdch_manager()->RemoveObserver(&observer); |
633 } | 633 } |
634 | 634 |
635 } // namespace net | 635 } // namespace net |
OLD | NEW |