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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 sdch_manager()->RemoveObserver(&observer); | 549 sdch_manager()->RemoveObserver(&observer); |
550 sdch_manager()->OnGetDictionary(test_request_gurl, test_dictionary_gurl); | 550 sdch_manager()->OnGetDictionary(test_request_gurl, test_dictionary_gurl); |
551 EXPECT_EQ(1, observer.get_dictionary_notifications()); | 551 EXPECT_EQ(1, observer.get_dictionary_notifications()); |
552 EXPECT_EQ(test_request_gurl, observer.last_dictionary_request_url()); | 552 EXPECT_EQ(test_request_gurl, observer.last_dictionary_request_url()); |
553 EXPECT_EQ(test_dictionary_gurl, observer.last_dictionary_url()); | 553 EXPECT_EQ(test_dictionary_gurl, observer.last_dictionary_url()); |
554 } | 554 } |
555 | 555 |
556 TEST_F(SdchManagerTest, ExpirationCheckedProperly) { | 556 TEST_F(SdchManagerTest, ExpirationCheckedProperly) { |
557 // Create an SDCH dictionary with an expiration time in the past. | 557 // Create an SDCH dictionary with an expiration time in the past. |
558 std::string dictionary_domain("x.y.z.google.com"); | 558 std::string dictionary_domain("x.y.z.google.com"); |
559 // TODO(eroman): "max-age: -1" is invalid (it is not a valid production of | |
560 // delta-seconds, which is non-negative). This test works | |
561 // as a consequence of crbug.com/602691. | |
Randy Smith (Not in Mondays)
2016/04/12 18:13:33
Would you be willing to expand the second sentence
eroman
2016/04/12 18:26:21
Done.
| |
559 std::string dictionary_text(base::StringPrintf("Domain: %s\nMax-age: -1\n\n", | 562 std::string dictionary_text(base::StringPrintf("Domain: %s\nMax-age: -1\n\n", |
560 dictionary_domain.c_str())); | 563 dictionary_domain.c_str())); |
561 dictionary_text.append( | 564 dictionary_text.append( |
562 kTestVcdiffDictionary, sizeof(kTestVcdiffDictionary) - 1); | 565 kTestVcdiffDictionary, sizeof(kTestVcdiffDictionary) - 1); |
563 std::string client_hash; | 566 std::string client_hash; |
564 std::string server_hash; | 567 std::string server_hash; |
565 SdchManager::GenerateHash(dictionary_text, &client_hash, &server_hash); | 568 SdchManager::GenerateHash(dictionary_text, &client_hash, &server_hash); |
566 GURL target_gurl("http://" + dictionary_domain); | 569 GURL target_gurl("http://" + dictionary_domain); |
567 AddSdchDictionary(dictionary_text, target_gurl); | 570 AddSdchDictionary(dictionary_text, target_gurl); |
568 | 571 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 EXPECT_EQ(server_hash, observer.last_server_hash()); | 629 EXPECT_EQ(server_hash, observer.last_server_hash()); |
627 | 630 |
628 EXPECT_EQ(SDCH_OK, sdch_manager()->RemoveSdchDictionary(server_hash)); | 631 EXPECT_EQ(SDCH_OK, sdch_manager()->RemoveSdchDictionary(server_hash)); |
629 EXPECT_EQ(1, observer.dictionary_removed_notifications()); | 632 EXPECT_EQ(1, observer.dictionary_removed_notifications()); |
630 EXPECT_EQ(server_hash, observer.last_server_hash()); | 633 EXPECT_EQ(server_hash, observer.last_server_hash()); |
631 | 634 |
632 sdch_manager()->RemoveObserver(&observer); | 635 sdch_manager()->RemoveObserver(&observer); |
633 } | 636 } |
634 | 637 |
635 } // namespace net | 638 } // namespace net |
OLD | NEW |