| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/content_settings/content_settings_details.h" | 9 #include "chrome/browser/content_settings/content_settings_details.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 ContentSettingsPattern pattern("[*.]example.com"); | 457 ContentSettingsPattern pattern("[*.]example.com"); |
| 458 | 458 |
| 459 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 459 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 460 host_content_settings_map->GetContentSetting( | 460 host_content_settings_map->GetContentSetting( |
| 461 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 461 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
| 462 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 462 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 463 otr_map->GetContentSetting( | 463 otr_map->GetContentSetting( |
| 464 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 464 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
| 465 | 465 |
| 466 // Changing content settings on the main map should also affect the | 466 // Changing content settings on the main map should also affect the |
| 467 // off-the-record map. | 467 // incognito map. |
| 468 host_content_settings_map->SetContentSetting(pattern, | 468 host_content_settings_map->SetContentSetting(pattern, |
| 469 CONTENT_SETTINGS_TYPE_IMAGES, "", CONTENT_SETTING_BLOCK); | 469 CONTENT_SETTINGS_TYPE_IMAGES, "", CONTENT_SETTING_BLOCK); |
| 470 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 470 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 471 host_content_settings_map->GetContentSetting( | 471 host_content_settings_map->GetContentSetting( |
| 472 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 472 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
| 473 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 473 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 474 otr_map->GetContentSetting( | 474 otr_map->GetContentSetting( |
| 475 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 475 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
| 476 | 476 |
| 477 // Changing content settings on the off-the-record map should NOT affect the | 477 // Changing content settings on the incognito map should NOT affect the |
| 478 // main map. | 478 // main map. |
| 479 otr_map->SetContentSetting(pattern, | 479 otr_map->SetContentSetting(pattern, |
| 480 CONTENT_SETTINGS_TYPE_IMAGES, "", CONTENT_SETTING_ALLOW); | 480 CONTENT_SETTINGS_TYPE_IMAGES, "", CONTENT_SETTING_ALLOW); |
| 481 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 481 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 482 host_content_settings_map->GetContentSetting( | 482 host_content_settings_map->GetContentSetting( |
| 483 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 483 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
| 484 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 484 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 485 otr_map->GetContentSetting( | 485 otr_map->GetContentSetting( |
| 486 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 486 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
| 487 } | 487 } |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 EXPECT_TRUE(host_content_settings_map->BlockThirdPartyCookies()); | 856 EXPECT_TRUE(host_content_settings_map->BlockThirdPartyCookies()); |
| 857 | 857 |
| 858 // After unsetting the managed value for the preference BlockThirdPartyCookies | 858 // After unsetting the managed value for the preference BlockThirdPartyCookies |
| 859 // the default value should be returned now. | 859 // the default value should be returned now. |
| 860 prefs->RemoveManagedPref(prefs::kBlockThirdPartyCookies); | 860 prefs->RemoveManagedPref(prefs::kBlockThirdPartyCookies); |
| 861 EXPECT_FALSE(host_content_settings_map->IsBlockThirdPartyCookiesManaged()); | 861 EXPECT_FALSE(host_content_settings_map->IsBlockThirdPartyCookiesManaged()); |
| 862 EXPECT_FALSE(host_content_settings_map->BlockThirdPartyCookies()); | 862 EXPECT_FALSE(host_content_settings_map->BlockThirdPartyCookies()); |
| 863 } | 863 } |
| 864 | 864 |
| 865 } // namespace | 865 } // namespace |
| OLD | NEW |