Commit 7ea904f6 authored by rtenneti@google.com's avatar rtenneti@google.com

SPDY - don't persist SpdySettings until we convert it to a map.

- Deleted the code that read and wrote the SpdySettings data
  from preferences.
- Disabled the code that persisted the SpdySettings data.
- Disabled the unit tests that tested persisting of SpdySettings.

BUG=118148
R=willchan
TEST=browser unit tests
Review URL: https://chromiumcodereview.appspot.com/9703050

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126838 0039d316-1c4b-4281-b951-d872f2087c98
parent 745d9622
...@@ -278,48 +278,8 @@ void HttpServerPropertiesManager::UpdateCacheFromPrefsOnUI() { ...@@ -278,48 +278,8 @@ void HttpServerPropertiesManager::UpdateCacheFromPrefsOnUI() {
spdy_servers->push_back(server_str); spdy_servers->push_back(server_str);
} }
// Get SpdySettings. // TODO(rtenneti): Implement reading of SpdySettings.
DCHECK(!ContainsKey(*spdy_settings_map, server)); DCHECK(!ContainsKey(*spdy_settings_map, server));
base::ListValue* spdy_settings_list = NULL;
if (server_pref_dict->GetListWithoutPathExpansion(
"settings", &spdy_settings_list)) {
spdy::SpdySettings spdy_settings;
for (base::ListValue::const_iterator list_it =
spdy_settings_list->begin();
list_it != spdy_settings_list->end(); ++list_it) {
if ((*list_it)->GetType() != Value::TYPE_DICTIONARY) {
DVLOG(1) << "Malformed SpdySettingsList for server: " << server_str;
detected_corrupted_prefs = true;
continue;
}
const base::DictionaryValue* spdy_setting_dict =
static_cast<const base::DictionaryValue*>(*list_it);
int id = 0;
if (!spdy_setting_dict->GetIntegerWithoutPathExpansion("id", &id)) {
DVLOG(1) << "Malformed id in SpdySettings for server: " << server_str;
detected_corrupted_prefs = true;
continue;
}
int value = 0;
if (!spdy_setting_dict->GetIntegerWithoutPathExpansion("value",
&value)) {
DVLOG(1) << "Malformed value in SpdySettings for server: " <<
server_str;
detected_corrupted_prefs = true;
continue;
}
spdy::SettingsFlagsAndId flags_and_id(
spdy::SETTINGS_FLAG_PERSISTED, id);
spdy_settings.push_back(spdy::SpdySetting(flags_and_id, value));
}
(*spdy_settings_map)[server] = spdy_settings;
}
int pipeline_capability = net::PIPELINE_UNKNOWN; int pipeline_capability = net::PIPELINE_UNKNOWN;
if ((server_pref_dict->GetInteger( if ((server_pref_dict->GetInteger(
...@@ -575,21 +535,7 @@ void HttpServerPropertiesManager::UpdatePrefsOnUI( ...@@ -575,21 +535,7 @@ void HttpServerPropertiesManager::UpdatePrefsOnUI(
// Save supports_spdy. // Save supports_spdy.
server_pref_dict->SetBoolean("supports_spdy", server_pref.supports_spdy); server_pref_dict->SetBoolean("supports_spdy", server_pref.supports_spdy);
// Save SpdySettings. // TODO(rtenneti): Implement save SpdySettings.
if (server_pref.settings) {
base::ListValue* spdy_settings_list = new ListValue();
for (spdy::SpdySettings::const_iterator it =
server_pref.settings->begin();
it != server_pref.settings->end(); ++it) {
uint32 id = it->first.id();
uint32 value = it->second;
base::DictionaryValue* spdy_setting_dict = new base::DictionaryValue;
spdy_setting_dict->SetInteger("id", id);
spdy_setting_dict->SetInteger("value", value);
spdy_settings_list->Append(spdy_setting_dict);
}
server_pref_dict->Set("settings", spdy_settings_list);
}
// Save alternate_protocol. // Save alternate_protocol.
if (server_pref.alternate_protocol) { if (server_pref.alternate_protocol) {
......
...@@ -139,15 +139,6 @@ TEST_F(HttpServerPropertiesManagerTest, ...@@ -139,15 +139,6 @@ TEST_F(HttpServerPropertiesManagerTest,
// Set supports_spdy for www.google.com:80. // Set supports_spdy for www.google.com:80.
server_pref_dict->SetBoolean("supports_spdy", true); server_pref_dict->SetBoolean("supports_spdy", true);
// Set up the SpdySettings for www.google.com:80.
base::ListValue* spdy_settings_list = new base::ListValue;
base::DictionaryValue* spdy_setting_dict = new base::DictionaryValue;
spdy_setting_dict->SetInteger("flags", spdy::SETTINGS_FLAG_PERSISTED);
spdy_setting_dict->SetInteger("id", 1234);
spdy_setting_dict->SetInteger("value", 31337);
spdy_settings_list->Append(spdy_setting_dict);
server_pref_dict->Set("settings", spdy_settings_list);
// Set up alternate_protocol for www.google.com:80. // Set up alternate_protocol for www.google.com:80.
base::DictionaryValue* alternate_protocol = new base::DictionaryValue; base::DictionaryValue* alternate_protocol = new base::DictionaryValue;
alternate_protocol->SetInteger("port", 443); alternate_protocol->SetInteger("port", 443);
...@@ -170,15 +161,6 @@ TEST_F(HttpServerPropertiesManagerTest, ...@@ -170,15 +161,6 @@ TEST_F(HttpServerPropertiesManagerTest,
// Set supports_spdy for mail.google.com:80 // Set supports_spdy for mail.google.com:80
server_pref_dict1->SetBoolean("supports_spdy", true); server_pref_dict1->SetBoolean("supports_spdy", true);
// Set up the SpdySettings for mail.google.com:80
base::ListValue* spdy_settings_list1 = new base::ListValue;
base::DictionaryValue* spdy_setting_dict1 = new base::DictionaryValue;
spdy_setting_dict1->SetInteger("flags", spdy::SETTINGS_FLAG_PERSISTED);
spdy_setting_dict1->SetInteger("id", 5678);
spdy_setting_dict1->SetInteger("value", 62667);
spdy_settings_list1->Append(spdy_setting_dict1);
server_pref_dict1->Set("settings", spdy_settings_list1);
// Set up alternate_protocol for mail.google.com:80 // Set up alternate_protocol for mail.google.com:80
base::DictionaryValue* alternate_protocol1 = new base::DictionaryValue; base::DictionaryValue* alternate_protocol1 = new base::DictionaryValue;
alternate_protocol1->SetInteger("port", 444); alternate_protocol1->SetInteger("port", 444);
...@@ -213,25 +195,6 @@ TEST_F(HttpServerPropertiesManagerTest, ...@@ -213,25 +195,6 @@ TEST_F(HttpServerPropertiesManagerTest,
EXPECT_FALSE(http_server_props_manager_->SupportsSpdy( EXPECT_FALSE(http_server_props_manager_->SupportsSpdy(
net::HostPortPair::FromString("foo.google.com:1337"))); net::HostPortPair::FromString("foo.google.com:1337")));
// Verify SpdySettings.
spdy::SpdySettings spdy_settings_ret =
http_server_props_manager_->GetSpdySettings(
net::HostPortPair::FromString("www.google.com:80"));
ASSERT_EQ(1U, spdy_settings_ret.size());
spdy::SpdySetting spdy_setting1_ret = spdy_settings_ret.front();
spdy::SettingsFlagsAndId id1_ret(spdy_setting1_ret.first);
EXPECT_EQ(1234U, id1_ret.id());
EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, id1_ret.flags());
EXPECT_EQ(31337u, spdy_setting1_ret.second);
spdy_settings_ret = http_server_props_manager_->GetSpdySettings(
net::HostPortPair::FromString("mail.google.com:80"));
ASSERT_EQ(1U, spdy_settings_ret.size());
spdy_setting1_ret = spdy_settings_ret.front();
id1_ret = spdy_setting1_ret.first;
EXPECT_EQ(5678U, id1_ret.id());
EXPECT_EQ(spdy::SETTINGS_FLAG_PERSISTED, id1_ret.flags());
EXPECT_EQ(62667u, spdy_setting1_ret.second);
// Verify AlternateProtocol. // Verify AlternateProtocol.
ASSERT_TRUE(http_server_props_manager_->HasAlternateProtocol( ASSERT_TRUE(http_server_props_manager_->HasAlternateProtocol(
net::HostPortPair::FromString("www.google.com:80"))); net::HostPortPair::FromString("www.google.com:80")));
......
...@@ -4453,6 +4453,8 @@ TEST_P(SpdyNetworkTransactionSpdy21Test, SettingsSaved) { ...@@ -4453,6 +4453,8 @@ TEST_P(SpdyNetworkTransactionSpdy21Test, SettingsSaved) {
EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line);
EXPECT_EQ("hello!", out.response_data); EXPECT_EQ("hello!", out.response_data);
// TODO(rtenneti): Persist spdy settings.
#ifdef PERSIST_SPDY_SETTINGS
{ {
// Verify we had two persisted settings. // Verify we had two persisted settings.
spdy::SpdySettings saved_settings = spdy::SpdySettings saved_settings =
...@@ -4474,6 +4476,7 @@ TEST_P(SpdyNetworkTransactionSpdy21Test, SettingsSaved) { ...@@ -4474,6 +4476,7 @@ TEST_P(SpdyNetworkTransactionSpdy21Test, SettingsSaved) {
EXPECT_EQ(kSampleId3, setting.first.id()); EXPECT_EQ(kSampleId3, setting.first.id());
EXPECT_EQ(kSampleValue3, setting.second); EXPECT_EQ(kSampleValue3, setting.second);
} }
#endif
} }
// Test that when there are settings saved that they are sent back to the // Test that when there are settings saved that they are sent back to the
......
...@@ -4089,6 +4089,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsSaved) { ...@@ -4089,6 +4089,8 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsSaved) {
EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line);
EXPECT_EQ("hello!", out.response_data); EXPECT_EQ("hello!", out.response_data);
// TODO(rtenneti): Persist spdy settings.
#ifdef PERSIST_SPDY_SETTINGS
{ {
// Verify we had two persisted settings. // Verify we had two persisted settings.
spdy::SpdySettings saved_settings = spdy::SpdySettings saved_settings =
...@@ -4110,6 +4112,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsSaved) { ...@@ -4110,6 +4112,7 @@ TEST_P(SpdyNetworkTransactionSpdy2Test, SettingsSaved) {
EXPECT_EQ(kSampleId3, setting.first.id()); EXPECT_EQ(kSampleId3, setting.first.id());
EXPECT_EQ(kSampleValue3, setting.second); EXPECT_EQ(kSampleValue3, setting.second);
} }
#endif
} }
// Test that when there are settings saved that they are sent back to the // Test that when there are settings saved that they are sent back to the
......
...@@ -4453,6 +4453,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsSaved) { ...@@ -4453,6 +4453,8 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsSaved) {
EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); EXPECT_EQ("HTTP/1.1 200 OK", out.status_line);
EXPECT_EQ("hello!", out.response_data); EXPECT_EQ("hello!", out.response_data);
// TODO(rtenneti): Persist spdy settings.
#ifdef PERSIST_SPDY_SETTINGS
{ {
// Verify we had two persisted settings. // Verify we had two persisted settings.
spdy::SpdySettings saved_settings = spdy::SpdySettings saved_settings =
...@@ -4474,6 +4476,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsSaved) { ...@@ -4474,6 +4476,7 @@ TEST_P(SpdyNetworkTransactionSpdy3Test, SettingsSaved) {
EXPECT_EQ(kSampleId3, setting.first.id()); EXPECT_EQ(kSampleId3, setting.first.id());
EXPECT_EQ(kSampleValue3, setting.second); EXPECT_EQ(kSampleValue3, setting.second);
} }
#endif
} }
// Test that when there are settings saved that they are sent back to the // Test that when there are settings saved that they are sent back to the
......
...@@ -1300,8 +1300,9 @@ void SpdySession::OnSetting(spdy::SpdySettingsIds id, ...@@ -1300,8 +1300,9 @@ void SpdySession::OnSetting(spdy::SpdySettingsIds id,
uint32 value) { uint32 value) {
HandleSetting(id, value); HandleSetting(id, value);
spdy::SettingsFlagsAndId flags_and_id(flags, id); spdy::SettingsFlagsAndId flags_and_id(flags, id);
http_server_properties_->SetSpdySetting( // TODO(rtenneti): persist SpdySetting.
host_port_pair(), std::make_pair(flags_and_id, value)); // http_server_properties_->SetSpdySetting(
// host_port_pair(), std::make_pair(flags_and_id, value));
received_settings_ = true; received_settings_ = true;
...@@ -1673,7 +1674,8 @@ void SpdySession::SendSettings() { ...@@ -1673,7 +1674,8 @@ void SpdySession::SendSettings() {
i->second = cwnd; i->second = cwnd;
i->first = new_id; i->first = new_id;
spdy::SpdySetting setting(new_id, val); spdy::SpdySetting setting(new_id, val);
http_server_properties_->SetSpdySetting(host_port_pair(), setting); // TODO(rtenneti): Persist SpdySetting.
// http_server_properties_->SetSpdySetting(host_port_pair(), setting);
unique_settings[id] = setting; unique_settings[id] = setting;
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment