| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/browser/content_settings/content_settings_mock_provider.h" | 8 #include "chrome/browser/content_settings/content_settings_mock_provider.h" |
| 9 #include "chrome/browser/content_settings/content_settings_utils.h" | 9 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 CONTENT_SETTINGS_TYPE_PLUGINS, | 46 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 47 "flash_plugin", false)); | 47 "flash_plugin", false)); |
| 48 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 48 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 49 GetContentSetting(&mock_provider, url, url, | 49 GetContentSetting(&mock_provider, url, url, |
| 50 CONTENT_SETTINGS_TYPE_GEOLOCATION, "", false)); | 50 CONTENT_SETTINGS_TYPE_GEOLOCATION, "", false)); |
| 51 EXPECT_EQ(NULL, | 51 EXPECT_EQ(NULL, |
| 52 GetContentSettingValue(&mock_provider, url, url, | 52 GetContentSettingValue(&mock_provider, url, url, |
| 53 CONTENT_SETTINGS_TYPE_GEOLOCATION, "", | 53 CONTENT_SETTINGS_TYPE_GEOLOCATION, "", |
| 54 false)); | 54 false)); |
| 55 | 55 |
| 56 mock_provider.SetContentSetting( | 56 bool owned = mock_provider.SetWebsiteSetting( |
| 57 pattern, | 57 pattern, |
| 58 pattern, | 58 pattern, |
| 59 CONTENT_SETTINGS_TYPE_PLUGINS, | 59 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 60 "java_plugin", | 60 "java_plugin", |
| 61 CONTENT_SETTING_ALLOW); | 61 Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); |
| 62 EXPECT_TRUE(owned); |
| 62 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 63 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 63 GetContentSetting(&mock_provider, url, url, | 64 GetContentSetting(&mock_provider, url, url, |
| 64 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", | 65 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", |
| 65 false)); | 66 false)); |
| 66 | 67 |
| 67 mock_provider.set_read_only(true); | 68 mock_provider.set_read_only(true); |
| 68 mock_provider.SetContentSetting( | 69 scoped_ptr<base::Value> value( |
| 70 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| 71 owned = mock_provider.SetWebsiteSetting( |
| 69 pattern, | 72 pattern, |
| 70 pattern, | 73 pattern, |
| 71 CONTENT_SETTINGS_TYPE_PLUGINS, | 74 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 72 "java_plugin", | 75 "java_plugin", |
| 73 CONTENT_SETTING_BLOCK); | 76 value.get()); |
| 77 EXPECT_FALSE(owned); |
| 74 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 78 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 75 GetContentSetting(&mock_provider, url, url, | 79 GetContentSetting(&mock_provider, url, url, |
| 76 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", | 80 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", |
| 77 false)); | 81 false)); |
| 78 | 82 |
| 79 EXPECT_TRUE(mock_provider.read_only()); | 83 EXPECT_TRUE(mock_provider.read_only()); |
| 80 | 84 |
| 81 mock_provider.set_read_only(false); | 85 mock_provider.set_read_only(false); |
| 82 mock_provider.SetContentSetting( | 86 owned = mock_provider.SetWebsiteSetting( |
| 83 pattern, | 87 pattern, |
| 84 pattern, | 88 pattern, |
| 85 CONTENT_SETTINGS_TYPE_PLUGINS, | 89 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 86 "java_plugin", | 90 "java_plugin", |
| 87 CONTENT_SETTING_BLOCK); | 91 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| 92 EXPECT_TRUE(owned); |
| 88 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 93 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 89 GetContentSetting(&mock_provider, url, url, | 94 GetContentSetting(&mock_provider, url, url, |
| 90 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", | 95 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", |
| 91 false)); | 96 false)); |
| 92 } | 97 } |
| 93 | 98 |
| 94 } // namespace content_settings | 99 } // namespace content_settings |
| OLD | NEW |