Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 std::string(), | 380 std::string(), |
| 381 CONTENT_SETTING_BLOCK); | 381 CONTENT_SETTING_BLOCK); |
| 382 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 382 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 383 host_content_settings_map->GetContentSetting( | 383 host_content_settings_map->GetContentSetting( |
| 384 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 384 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 385 | 385 |
| 386 // Make a copy of the pref's new value so we can reset it later. | 386 // Make a copy of the pref's new value so we can reset it later. |
| 387 scoped_ptr<base::Value> new_value(prefs->FindPreference( | 387 scoped_ptr<base::Value> new_value(prefs->FindPreference( |
| 388 prefs::kContentSettingsPatternPairs)->GetValue()->DeepCopy()); | 388 prefs::kContentSettingsPatternPairs)->GetValue()->DeepCopy()); |
| 389 | 389 |
| 390 LOG(ERROR) << "About to clear."; | |
|
raymes
2015/04/01 06:51:20
nit: Are you intentionally adding this?
| |
| 391 | |
| 390 // Clearing the backing pref should also clear the internal cache. | 392 // Clearing the backing pref should also clear the internal cache. |
| 391 prefs->Set(prefs::kContentSettingsPatternPairs, *default_value); | 393 prefs->Set(prefs::kContentSettingsPatternPairs, *default_value); |
| 392 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 394 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 393 host_content_settings_map->GetContentSetting( | 395 host_content_settings_map->GetContentSetting( |
| 394 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 396 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 395 | 397 |
| 398 LOG(ERROR) << "About to repopulate"; | |
| 399 | |
| 396 // Reseting the pref to its previous value should update the cache. | 400 // Reseting the pref to its previous value should update the cache. |
| 397 prefs->Set(prefs::kContentSettingsPatternPairs, *new_value); | 401 prefs->Set(prefs::kContentSettingsPatternPairs, *new_value); |
| 398 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 402 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 399 host_content_settings_map->GetContentSetting( | 403 host_content_settings_map->GetContentSetting( |
| 400 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 404 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 401 } | 405 } |
| 402 | 406 |
| 403 TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { | 407 TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) { |
| 404 TestingProfile profile; | 408 TestingProfile profile; |
| 405 HostContentSettingsMap* host_content_settings_map = | 409 HostContentSettingsMap* host_content_settings_map = |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1062 CONTENT_SETTINGS_TYPE_IMAGES, true); | 1066 CONTENT_SETTINGS_TYPE_IMAGES, true); |
| 1063 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1067 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 1064 host_content_settings_map->GetContentSetting( | 1068 host_content_settings_map->GetContentSetting( |
| 1065 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 1069 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 1066 host_content_settings_map->SetDefaultContentSetting( | 1070 host_content_settings_map->SetDefaultContentSetting( |
| 1067 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); | 1071 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); |
| 1068 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 1072 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 1069 host_content_settings_map->GetContentSetting( | 1073 host_content_settings_map->GetContentSetting( |
| 1070 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 1074 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 1071 } | 1075 } |
| OLD | NEW |