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" |
11 | 11 |
12 namespace content_settings { | 12 namespace content_settings { |
13 | 13 |
14 TEST(ContentSettingsProviderTest, Mock) { | 14 TEST(ContentSettingsProviderTest, Mock) { |
15 ContentSettingsPattern pattern = | 15 ContentSettingsPattern pattern = |
16 ContentSettingsPattern::FromString("[*.]youtube.com"); | 16 ContentSettingsPattern::FromString("[*.]youtube.com"); |
17 GURL url("http://www.youtube.com"); | 17 GURL url("http://www.youtube.com"); |
18 | 18 |
19 MockProvider mock_provider( | 19 MockProvider mock_provider(false); |
| 20 mock_provider.SetWebsiteSetting( |
20 pattern, | 21 pattern, |
21 pattern, | 22 pattern, |
22 CONTENT_SETTINGS_TYPE_PLUGINS, | 23 CONTENT_SETTINGS_TYPE_PLUGINS, |
23 "java_plugin", | 24 "java_plugin", |
24 CONTENT_SETTING_BLOCK, | 25 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
25 false, | 26 |
26 false); | |
27 | 27 |
28 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 28 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
29 GetContentSetting(&mock_provider, url, url, | 29 GetContentSetting(&mock_provider, url, url, |
30 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", | 30 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", |
31 false)); | 31 false)); |
32 scoped_ptr<Value> value_ptr( | 32 scoped_ptr<Value> value_ptr( |
33 GetContentSettingValue(&mock_provider, url, url, | 33 GetContentSettingValue(&mock_provider, url, url, |
34 CONTENT_SETTINGS_TYPE_PLUGINS, | 34 CONTENT_SETTINGS_TYPE_PLUGINS, |
35 "java_plugin", false)); | 35 "java_plugin", false)); |
36 int int_value = -1; | 36 int int_value = -1; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 "java_plugin", | 90 "java_plugin", |
91 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); | 91 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
92 EXPECT_TRUE(owned); | 92 EXPECT_TRUE(owned); |
93 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 93 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
94 GetContentSetting(&mock_provider, url, url, | 94 GetContentSetting(&mock_provider, url, url, |
95 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", | 95 CONTENT_SETTINGS_TYPE_PLUGINS, "java_plugin", |
96 false)); | 96 false)); |
97 } | 97 } |
98 | 98 |
99 } // namespace content_settings | 99 } // namespace content_settings |
OLD | NEW |