| Index: net/base/sdch_manager_unittest.cc
|
| diff --git a/net/base/sdch_manager_unittest.cc b/net/base/sdch_manager_unittest.cc
|
| index f95e8eeb62a32d1e245d8e7c9397ec52342042f4..3906fc0816882ab48cb8a21c12c3ae9c58ccfdda 100644
|
| --- a/net/base/sdch_manager_unittest.cc
|
| +++ b/net/base/sdch_manager_unittest.cc
|
| @@ -16,16 +16,15 @@ namespace net {
|
| //------------------------------------------------------------------------------
|
| // Provide sample data and compression results with a sample VCDIFF dictionary.
|
| // Note an SDCH dictionary has extra meta-data before the VCDIFF dictionary.
|
| -static const char kTestVcdiffDictionary[] = "DictionaryFor"
|
| +static const char kTestVcdiffDictionary[] =
|
| + "DictionaryFor"
|
| "SdchCompression1SdchCompression2SdchCompression3SdchCompression\n";
|
|
|
| //------------------------------------------------------------------------------
|
|
|
| class SdchManagerTest : public testing::Test {
|
| protected:
|
| - SdchManagerTest()
|
| - : sdch_manager_(new SdchManager) {
|
| - }
|
| + SdchManagerTest() : sdch_manager_(new SdchManager) {}
|
|
|
| scoped_ptr<SdchManager> sdch_manager_; // A singleton database.
|
| };
|
| @@ -131,22 +130,21 @@ TEST_F(SdchManagerTest, CanSetExactMatchDictionary) {
|
| std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
|
|
| // Perfect match should work.
|
| - EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://" + dictionary_domain)));
|
| + EXPECT_TRUE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("http://" + dictionary_domain)));
|
| }
|
|
|
| TEST_F(SdchManagerTest, CanAdvertiseDictionaryOverHTTP) {
|
| std::string dictionary_domain("x.y.z.google.com");
|
| std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
|
|
| - EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://" + dictionary_domain)));
|
| + EXPECT_TRUE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("http://" + dictionary_domain)));
|
|
|
| std::string dictionary_list;
|
| // HTTP target URL can advertise dictionary.
|
| sdch_manager_->GetAvailDictionaryList(
|
| - GURL("http://" + dictionary_domain + "/test"),
|
| - &dictionary_list);
|
| + GURL("http://" + dictionary_domain + "/test"), &dictionary_list);
|
| EXPECT_FALSE(dictionary_list.empty());
|
| }
|
|
|
| @@ -154,14 +152,13 @@ TEST_F(SdchManagerTest, CanNotAdvertiseDictionaryOverHTTPS) {
|
| std::string dictionary_domain("x.y.z.google.com");
|
| std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
|
|
| - EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://" + dictionary_domain)));
|
| + EXPECT_TRUE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("http://" + dictionary_domain)));
|
|
|
| std::string dictionary_list;
|
| // HTTPS target URL should NOT advertise dictionary.
|
| sdch_manager_->GetAvailDictionaryList(
|
| - GURL("https://" + dictionary_domain + "/test"),
|
| - &dictionary_list);
|
| + GURL("https://" + dictionary_domain + "/test"), &dictionary_list);
|
| EXPECT_TRUE(dictionary_list.empty());
|
| }
|
|
|
| @@ -169,8 +166,8 @@ TEST_F(SdchManagerTest, CanUseHTTPSDictionaryOverHTTPSIfEnabled) {
|
| std::string dictionary_domain("x.y.z.google.com");
|
| std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
|
|
| - EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("https://" + dictionary_domain)));
|
| + EXPECT_TRUE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("https://" + dictionary_domain)));
|
|
|
| GURL target_url("https://" + dictionary_domain + "/test");
|
| std::string dictionary_list;
|
| @@ -193,8 +190,8 @@ TEST_F(SdchManagerTest, CanNotUseHTTPDictionaryOverHTTPS) {
|
| std::string dictionary_domain("x.y.z.google.com");
|
| std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
|
|
| - EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://" + dictionary_domain)));
|
| + EXPECT_TRUE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("http://" + dictionary_domain)));
|
|
|
| GURL target_url("https://" + dictionary_domain + "/test");
|
| std::string dictionary_list;
|
| @@ -218,7 +215,7 @@ TEST_F(SdchManagerTest, FailToSetDomainMismatchDictionary) {
|
|
|
| // Fail the "domain match" requirement.
|
| EXPECT_FALSE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://y.z.google.com")));
|
| + GURL("http://y.z.google.com")));
|
| }
|
|
|
| TEST_F(SdchManagerTest, FailToSetDotHostPrefixDomainDictionary) {
|
| @@ -226,8 +223,8 @@ TEST_F(SdchManagerTest, FailToSetDotHostPrefixDomainDictionary) {
|
| std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
|
|
| // Fail the HD with D being the domain and H having a dot requirement.
|
| - EXPECT_FALSE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://w.x.y.z.google.com")));
|
| + EXPECT_FALSE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("http://w.x.y.z.google.com")));
|
| }
|
|
|
| TEST_F(SdchManagerTest, FailToSetRepeatPrefixWithDotDictionary) {
|
| @@ -237,8 +234,8 @@ TEST_F(SdchManagerTest, FailToSetRepeatPrefixWithDotDictionary) {
|
| std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
|
|
| // Fail the HD with D being the domain and H having a dot requirement.
|
| - EXPECT_FALSE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://www.google.com.www.google.com")));
|
| + EXPECT_FALSE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("http://www.google.com.www.google.com")));
|
| }
|
|
|
| TEST_F(SdchManagerTest, CanSetLeadingDotDomainDictionary) {
|
| @@ -250,7 +247,7 @@ TEST_F(SdchManagerTest, CanSetLeadingDotDomainDictionary) {
|
| // Verify that a leading dot in the domain is acceptable, as long as the host
|
| // name does not contain any dots preceding the matched domain name.
|
| EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://www.google.com")));
|
| + GURL("http://www.google.com")));
|
| }
|
|
|
| // Make sure the order of the tests is not helping us or confusing things.
|
| @@ -260,8 +257,8 @@ TEST_F(SdchManagerTest, CanStillSetExactMatchDictionary) {
|
| std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
|
|
| // Perfect match should *STILL* work.
|
| - EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://" + dictionary_domain)));
|
| + EXPECT_TRUE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("http://" + dictionary_domain)));
|
| }
|
|
|
| // Make sure the DOS protection precludes the addition of too many dictionaries.
|
| @@ -286,9 +283,9 @@ TEST_F(SdchManagerTest, DictionaryNotTooLarge) {
|
| std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
|
|
| dictionary_text.append(
|
| - SdchManager::kMaxDictionarySize - dictionary_text.size(), ' ');
|
| - EXPECT_TRUE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://" + dictionary_domain)));
|
| + SdchManager::kMaxDictionarySize - dictionary_text.size(), ' ');
|
| + EXPECT_TRUE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("http://" + dictionary_domain)));
|
| }
|
|
|
| TEST_F(SdchManagerTest, DictionaryTooLarge) {
|
| @@ -297,8 +294,8 @@ TEST_F(SdchManagerTest, DictionaryTooLarge) {
|
|
|
| dictionary_text.append(
|
| SdchManager::kMaxDictionarySize + 1 - dictionary_text.size(), ' ');
|
| - EXPECT_FALSE(sdch_manager_->AddSdchDictionary(dictionary_text,
|
| - GURL("http://" + dictionary_domain)));
|
| + EXPECT_FALSE(sdch_manager_->AddSdchDictionary(
|
| + dictionary_text, GURL("http://" + dictionary_domain)));
|
| }
|
|
|
| TEST_F(SdchManagerTest, PathMatch) {
|
| @@ -371,4 +368,3 @@ TEST_F(SdchManagerTest, LatencyTestControls) {
|
| }
|
|
|
| } // namespace net
|
| -
|
|
|