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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "chrome/browser/content_settings/content_settings_mock_observer.h" | 8 #include "chrome/browser/content_settings/content_settings_mock_observer.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 95 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
96 TestUtils::GetContentSetting(&provider_, primary_url, secondary_url, | 96 TestUtils::GetContentSetting(&provider_, primary_url, secondary_url, |
97 CONTENT_SETTINGS_TYPE_COOKIES, | 97 CONTENT_SETTINGS_TYPE_COOKIES, |
98 std::string(), false)); | 98 std::string(), false)); |
99 } | 99 } |
100 | 100 |
101 TEST_F(DefaultProviderTest, Observer) { | 101 TEST_F(DefaultProviderTest, Observer) { |
102 MockObserver mock_observer; | 102 MockObserver mock_observer; |
103 EXPECT_CALL(mock_observer, | 103 EXPECT_CALL(mock_observer, |
104 OnContentSettingChanged( | 104 OnContentSettingChanged( |
105 _, _, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 105 _, _, CONTENT_SETTINGS_TYPE_COOKIES, "")); |
106 provider_.AddObserver(&mock_observer); | 106 provider_.AddObserver(&mock_observer); |
107 provider_.SetWebsiteSetting( | 107 provider_.SetWebsiteSetting( |
108 ContentSettingsPattern::Wildcard(), | 108 ContentSettingsPattern::Wildcard(), |
109 ContentSettingsPattern::Wildcard(), | 109 ContentSettingsPattern::Wildcard(), |
110 CONTENT_SETTINGS_TYPE_IMAGES, | 110 CONTENT_SETTINGS_TYPE_COOKIES, |
111 std::string(), | 111 std::string(), |
112 new base::FundamentalValue(CONTENT_SETTING_BLOCK)); | 112 new base::FundamentalValue(CONTENT_SETTING_BLOCK)); |
113 | 113 |
114 EXPECT_CALL(mock_observer, | 114 EXPECT_CALL(mock_observer, |
115 OnContentSettingChanged( | 115 OnContentSettingChanged( |
116 _, _, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); | 116 _, _, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); |
117 provider_.SetWebsiteSetting( | 117 provider_.SetWebsiteSetting( |
118 ContentSettingsPattern::Wildcard(), | 118 ContentSettingsPattern::Wildcard(), |
119 ContentSettingsPattern::Wildcard(), | 119 ContentSettingsPattern::Wildcard(), |
120 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 120 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 207 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
208 TestUtils::GetContentSetting( | 208 TestUtils::GetContentSetting( |
209 &otr_provider2, GURL(), GURL(), CONTENT_SETTINGS_TYPE_COOKIES, | 209 &otr_provider2, GURL(), GURL(), CONTENT_SETTINGS_TYPE_COOKIES, |
210 std::string(), true /* include_incognito */)); | 210 std::string(), true /* include_incognito */)); |
211 | 211 |
212 otr_provider.ShutdownOnUIThread(); | 212 otr_provider.ShutdownOnUIThread(); |
213 otr_provider2.ShutdownOnUIThread(); | 213 otr_provider2.ShutdownOnUIThread(); |
214 } | 214 } |
215 | 215 |
216 } // namespace content_settings | 216 } // namespace content_settings |
OLD | NEW |