| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_content_settings_store.h" | 5 #include "chrome/browser/extensions/extension_content_settings_store.h" |
| 6 | 6 |
| 7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 using ::testing::Mock; | 10 using ::testing::Mock; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 ContentSettingsPattern pattern = | 69 ContentSettingsPattern pattern = |
| 70 ContentSettingsPattern::FromString("http://www.youtube.com"); | 70 ContentSettingsPattern::FromString("http://www.youtube.com"); |
| 71 EXPECT_CALL(observer, OnContentSettingChanged(ext_id, false)); | 71 EXPECT_CALL(observer, OnContentSettingChanged(ext_id, false)); |
| 72 map.SetExtensionContentSetting( | 72 map.SetExtensionContentSetting( |
| 73 ext_id, | 73 ext_id, |
| 74 pattern, | 74 pattern, |
| 75 pattern, | 75 pattern, |
| 76 CONTENT_SETTINGS_TYPE_COOKIES, | 76 CONTENT_SETTINGS_TYPE_COOKIES, |
| 77 "", | 77 "", |
| 78 CONTENT_SETTING_ALLOW, | 78 CONTENT_SETTING_ALLOW, |
| 79 false); | 79 extension_prefs_scope::kRegular); |
| 80 Mock::VerifyAndClear(&observer); | 80 Mock::VerifyAndClear(&observer); |
| 81 | 81 |
| 82 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 82 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 83 map.GetEffectiveContentSetting( | 83 map.GetEffectiveContentSetting( |
| 84 url, | 84 url, |
| 85 url, | 85 url, |
| 86 CONTENT_SETTINGS_TYPE_COOKIES, | 86 CONTENT_SETTINGS_TYPE_COOKIES, |
| 87 "", | 87 "", |
| 88 false)); | 88 false)); |
| 89 | 89 |
| 90 // Register second extension. | 90 // Register second extension. |
| 91 std::string ext_id_2("my_second_extension"); | 91 std::string ext_id_2("my_second_extension"); |
| 92 base::Time time_2 = timer.GetNext(); | 92 base::Time time_2 = timer.GetNext(); |
| 93 map.RegisterExtension(ext_id_2, time_2, true); | 93 map.RegisterExtension(ext_id_2, time_2, true); |
| 94 EXPECT_CALL(observer, OnContentSettingChanged(ext_id_2, false)); | 94 EXPECT_CALL(observer, OnContentSettingChanged(ext_id_2, false)); |
| 95 map.SetExtensionContentSetting( | 95 map.SetExtensionContentSetting( |
| 96 ext_id_2, | 96 ext_id_2, |
| 97 pattern, | 97 pattern, |
| 98 pattern, | 98 pattern, |
| 99 CONTENT_SETTINGS_TYPE_COOKIES, | 99 CONTENT_SETTINGS_TYPE_COOKIES, |
| 100 "", | 100 "", |
| 101 CONTENT_SETTING_BLOCK, | 101 CONTENT_SETTING_BLOCK, |
| 102 false); | 102 extension_prefs_scope::kRegular); |
| 103 | 103 |
| 104 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 104 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 105 map.GetEffectiveContentSetting( | 105 map.GetEffectiveContentSetting( |
| 106 url, | 106 url, |
| 107 url, | 107 url, |
| 108 CONTENT_SETTINGS_TYPE_COOKIES, | 108 CONTENT_SETTINGS_TYPE_COOKIES, |
| 109 "", | 109 "", |
| 110 false)); | 110 false)); |
| 111 | 111 |
| 112 // Unregister first extension. This shouldn't change the setting. | 112 // Unregister first extension. This shouldn't change the setting. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 129 map.GetEffectiveContentSetting( | 129 map.GetEffectiveContentSetting( |
| 130 url, | 130 url, |
| 131 url, | 131 url, |
| 132 CONTENT_SETTINGS_TYPE_COOKIES, | 132 CONTENT_SETTINGS_TYPE_COOKIES, |
| 133 "", | 133 "", |
| 134 false)); | 134 false)); |
| 135 Mock::VerifyAndClear(&observer); | 135 Mock::VerifyAndClear(&observer); |
| 136 | 136 |
| 137 EXPECT_CALL(observer, OnDestruction()); | 137 EXPECT_CALL(observer, OnDestruction()); |
| 138 } | 138 } |
| OLD | NEW |