| 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/content_settings/content_settings_policy_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_policy_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "chrome/browser/content_settings/content_settings_mock_observer.h" | 14 #include "chrome/browser/content_settings/content_settings_mock_observer.h" |
| 15 #include "chrome/browser/content_settings/content_settings_rule.h" | 15 #include "chrome/browser/content_settings/content_settings_rule.h" |
| 16 #include "chrome/browser/content_settings/content_settings_utils.h" | 16 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 17 #include "chrome/common/chrome_content_settings_client.h" |
| 17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 19 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 20 #include "chrome/test/base/testing_pref_service_syncable.h" | 21 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 21 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
| 22 #include "content/public/test/test_browser_thread.h" | 23 #include "content/public/test/test_browser_thread.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| 25 | 26 |
| 26 using ::testing::_; | 27 using ::testing::_; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 TestingProfile profile; | 138 TestingProfile profile; |
| 138 TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); | 139 TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); |
| 139 | 140 |
| 140 base::ListValue* value = new base::ListValue(); | 141 base::ListValue* value = new base::ListValue(); |
| 141 value->Append(new base::StringValue("[*.]google.com")); | 142 value->Append(new base::StringValue("[*.]google.com")); |
| 142 prefs->SetManagedPref(prefs::kManagedImagesBlockedForUrls, | 143 prefs->SetManagedPref(prefs::kManagedImagesBlockedForUrls, |
| 143 value); | 144 value); |
| 144 | 145 |
| 145 PolicyProvider provider(prefs); | 146 PolicyProvider provider(prefs); |
| 146 | 147 |
| 148 content_settings::ChromeContentSettingsClient client; |
| 147 ContentSettingsPattern yt_url_pattern = | 149 ContentSettingsPattern yt_url_pattern = |
| 148 ContentSettingsPattern::FromString("www.youtube.com"); | 150 ContentSettingsPattern::FromString(&client, "www.youtube.com"); |
| 149 GURL youtube_url("http://www.youtube.com"); | 151 GURL youtube_url("http://www.youtube.com"); |
| 150 GURL google_url("http://mail.google.com"); | 152 GURL google_url("http://mail.google.com"); |
| 151 | 153 |
| 152 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 154 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 153 GetContentSetting(&provider, | 155 GetContentSetting(&provider, |
| 154 youtube_url, | 156 youtube_url, |
| 155 youtube_url, | 157 youtube_url, |
| 156 CONTENT_SETTINGS_TYPE_COOKIES, | 158 CONTENT_SETTINGS_TYPE_COOKIES, |
| 157 std::string(), | 159 std::string(), |
| 158 false)); | 160 false)); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 ASSERT_EQ(base::Value::TYPE_DICTIONARY, cert_filter->GetType()); | 289 ASSERT_EQ(base::Value::TYPE_DICTIONARY, cert_filter->GetType()); |
| 288 base::DictionaryValue* dict_value = | 290 base::DictionaryValue* dict_value = |
| 289 static_cast<base::DictionaryValue*>(cert_filter.get()); | 291 static_cast<base::DictionaryValue*>(cert_filter.get()); |
| 290 std::string actual_common_name; | 292 std::string actual_common_name; |
| 291 ASSERT_TRUE(dict_value->GetString("ISSUER.CN", &actual_common_name)); | 293 ASSERT_TRUE(dict_value->GetString("ISSUER.CN", &actual_common_name)); |
| 292 EXPECT_EQ("issuer name", actual_common_name); | 294 EXPECT_EQ("issuer name", actual_common_name); |
| 293 provider.ShutdownOnUIThread(); | 295 provider.ShutdownOnUIThread(); |
| 294 } | 296 } |
| 295 | 297 |
| 296 } // namespace content_settings | 298 } // namespace content_settings |
| OLD | NEW |