| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "components/content_settings/core/browser/content_settings_info.h" | 10 #include "components/content_settings/core/browser/content_settings_info.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 WebsiteSettingsRegistry website_settings_registry_; | 31 WebsiteSettingsRegistry website_settings_registry_; |
| 32 ContentSettingsRegistry registry_; | 32 ContentSettingsRegistry registry_; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 TEST_F(ContentSettingsRegistryTest, GetPlatformDependent) { | 35 TEST_F(ContentSettingsRegistryTest, GetPlatformDependent) { |
| 36 #if defined(OS_IOS) | 36 #if defined(OS_IOS) |
| 37 // Javascript shouldn't be registered on iOS. | 37 // Javascript shouldn't be registered on iOS. |
| 38 EXPECT_FALSE(registry()->Get(CONTENT_SETTINGS_TYPE_JAVASCRIPT)); | 38 EXPECT_FALSE(registry()->Get(CONTENT_SETTINGS_TYPE_JAVASCRIPT)); |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 #if defined(OS_IOS) || defined(OS_ANDROID) |
| 42 // Images shouldn't be registered on mobile. |
| 43 EXPECT_FALSE(registry()->Get(CONTENT_SETTINGS_TYPE_IMAGES)); |
| 44 #endif |
| 45 |
| 41 // Protected media identifier only get registered on android and chromeos. | 46 // Protected media identifier only get registered on android and chromeos. |
| 42 #if defined(ANDROID) | defined(OS_CHROMEOS) | 47 #if defined(ANDROID) || defined(OS_CHROMEOS) |
| 43 EXPECT_TRUE( | 48 EXPECT_TRUE( |
| 44 registry()->Get(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER)); | 49 registry()->Get(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER)); |
| 45 #else | 50 #else |
| 46 EXPECT_FALSE( | 51 EXPECT_FALSE( |
| 47 registry()->Get(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER)); | 52 registry()->Get(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER)); |
| 48 #endif | 53 #endif |
| 49 | 54 |
| 50 // Cookies is registered on all platforms. | 55 // Cookies is registered on all platforms. |
| 51 EXPECT_TRUE(registry()->Get(CONTENT_SETTINGS_TYPE_COOKIES)); | 56 EXPECT_TRUE(registry()->Get(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 52 } | 57 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 EXPECT_EQ(registry()->Get(type), info); | 108 EXPECT_EQ(registry()->Get(type), info); |
| 104 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { | 109 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| 105 EXPECT_FALSE(plugins_found); | 110 EXPECT_FALSE(plugins_found); |
| 106 plugins_found = true; | 111 plugins_found = true; |
| 107 } else if (type == CONTENT_SETTINGS_TYPE_COOKIES) { | 112 } else if (type == CONTENT_SETTINGS_TYPE_COOKIES) { |
| 108 EXPECT_FALSE(cookies_found); | 113 EXPECT_FALSE(cookies_found); |
| 109 cookies_found = true; | 114 cookies_found = true; |
| 110 } | 115 } |
| 111 } | 116 } |
| 112 | 117 |
| 113 #if defined(OS_IOS) | 118 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 114 EXPECT_FALSE(plugins_found); | 119 EXPECT_FALSE(plugins_found); |
| 115 #else | 120 #else |
| 116 EXPECT_TRUE(plugins_found); | 121 EXPECT_TRUE(plugins_found); |
| 117 #endif | 122 #endif |
| 118 | 123 |
| 119 EXPECT_TRUE(cookies_found); | 124 EXPECT_TRUE(cookies_found); |
| 120 } | 125 } |
| 121 | 126 |
| 122 } // namespace content_settings | 127 } // namespace content_settings |
| OLD | NEW |