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..6da98976c4fb674035e2ec81670da6029873c8b3 100644 |
--- a/net/base/sdch_manager_unittest.cc |
+++ b/net/base/sdch_manager_unittest.cc |
@@ -27,6 +27,12 @@ class SdchManagerTest : public testing::Test { |
: sdch_manager_(new SdchManager) { |
} |
+ // Reset globals back to default state. |
+ virtual void TearDown() { |
+ net::SdchManager::EnableSdchSupport(true); |
+ net::SdchManager::EnableSecureSchemeSupport(false); |
mmenke
2014/06/15 22:38:58
nit: net not needed.
Randy Smith (Not in Mondays)
2014/06/15 23:37:17
Done.
|
+ } |
+ |
scoped_ptr<SdchManager> sdch_manager_; // A singleton database. |
}; |
@@ -169,14 +175,16 @@ 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_FALSE(sdch_manager_->AddSdchDictionary( |
+ dictionary_text, GURL("https://" + dictionary_domain))); |
+ sdch_manager_->EnableSecureSchemeSupport(true); |
mmenke
2014/06/15 22:38:58
Think it's clearer this is a static function if yo
Randy Smith (Not in Mondays)
2014/06/15 23:37:17
Good point. Done.
(Did both of these throughout
|
+ EXPECT_TRUE(sdch_manager_->AddSdchDictionary( |
+ dictionary_text, GURL("https://" + dictionary_domain))); |
GURL target_url("https://" + dictionary_domain + "/test"); |
std::string dictionary_list; |
// HTTPS target URL should advertise dictionary if secure scheme support is |
// enabled. |
- sdch_manager_->EnableSecureSchemeSupport(true); |
sdch_manager_->GetAvailDictionaryList(target_url, &dictionary_list); |
EXPECT_FALSE(dictionary_list.empty()); |
@@ -370,5 +378,17 @@ TEST_F(SdchManagerTest, LatencyTestControls) { |
EXPECT_FALSE(sdch_manager_->AllowLatencyExperiment(url2)); |
} |
+TEST_F(SdchManagerTest, HttpsCorrectlySupported) { |
+ GURL url("http://www.google.com"); |
+ GURL secure_url("https://www.google.com"); |
+ |
+ EXPECT_TRUE(sdch_manager_->IsInSupportedDomain(url)); |
+ EXPECT_FALSE(sdch_manager_->IsInSupportedDomain(secure_url)); |
+ |
+ sdch_manager_->EnableSecureSchemeSupport(true); |
+ EXPECT_TRUE(sdch_manager_->IsInSupportedDomain(url)); |
+ EXPECT_TRUE(sdch_manager_->IsInSupportedDomain(secure_url)); |
+} |
+ |
} // namespace net |