Chromium Code Reviews| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 EXPECT_EQ(user_prefs::PrefRegistrySyncable::SYNCABLE_PREF, | 65 EXPECT_EQ(user_prefs::PrefRegistrySyncable::SYNCABLE_PREF, |
| 66 website_settings_info->GetPrefRegistrationFlags()); | 66 website_settings_info->GetPrefRegistrationFlags()); |
| 67 | 67 |
| 68 // Check the WebsiteSettingsInfo is registered correctly. | 68 // Check the WebsiteSettingsInfo is registered correctly. |
| 69 EXPECT_EQ(website_settings_registry()->Get(CONTENT_SETTINGS_TYPE_COOKIES), | 69 EXPECT_EQ(website_settings_registry()->Get(CONTENT_SETTINGS_TYPE_COOKIES), |
| 70 website_settings_info); | 70 website_settings_info); |
| 71 } | 71 } |
| 72 | 72 |
| 73 TEST_F(ContentSettingsRegistryTest, Iteration) { | 73 TEST_F(ContentSettingsRegistryTest, Iteration) { |
| 74 // Check that plugins and cookies settings appear once during iteration. | 74 // Check that plugins and cookies settings appear once during iteration. |
| 75 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
|
raymes
2016/05/20 19:10:16
instead of ifdefing this out, perhaps we could jus
lshang
2016/05/24 11:55:45
Done.
| |
| 75 bool plugins_found = false; | 76 bool plugins_found = false; |
| 77 #endif | |
| 76 bool cookies_found = false; | 78 bool cookies_found = false; |
| 77 for (const ContentSettingsInfo* info : *registry()) { | 79 for (const ContentSettingsInfo* info : *registry()) { |
| 78 ContentSettingsType type = info->website_settings_info()->type(); | 80 ContentSettingsType type = info->website_settings_info()->type(); |
| 79 EXPECT_EQ(registry()->Get(type), info); | 81 EXPECT_EQ(registry()->Get(type), info); |
| 82 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 80 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { | 83 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| 81 EXPECT_FALSE(plugins_found); | 84 EXPECT_FALSE(plugins_found); |
| 82 plugins_found = true; | 85 plugins_found = true; |
| 83 } else if (type == CONTENT_SETTINGS_TYPE_COOKIES) { | 86 } |
| 87 #endif | |
| 88 if (type == CONTENT_SETTINGS_TYPE_COOKIES) { | |
| 84 EXPECT_FALSE(cookies_found); | 89 EXPECT_FALSE(cookies_found); |
| 85 cookies_found = true; | 90 cookies_found = true; |
| 86 } | 91 } |
| 87 } | 92 } |
| 88 | 93 |
| 94 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 89 EXPECT_TRUE(plugins_found); | 95 EXPECT_TRUE(plugins_found); |
| 96 #endif | |
| 90 EXPECT_TRUE(cookies_found); | 97 EXPECT_TRUE(cookies_found); |
| 91 } | 98 } |
| 92 | 99 |
| 93 } // namespace content_settings | 100 } // namespace content_settings |
| OLD | NEW |