| 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 #include <iostream> |
| 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" |
| 11 #include "components/content_settings/core/browser/content_settings_registry.h" | 11 #include "components/content_settings/core/browser/content_settings_registry.h" |
| 12 #include "components/content_settings/core/browser/website_settings_info.h" | 12 #include "components/content_settings/core/browser/website_settings_info.h" |
| 13 #include "components/content_settings/core/browser/website_settings_registry.h" | 13 #include "components/content_settings/core/browser/website_settings_registry.h" |
| 14 #include "components/content_settings/core/common/content_settings.h" | 14 #include "components/content_settings/core/common/content_settings.h" |
| 15 #include "components/content_settings/core/common/content_settings_types.h" | 15 #include "components/content_settings/core/common/content_settings_types.h" |
| 16 #include "components/pref_registry/pref_registry_syncable.h" | 16 #include "components/pref_registry/pref_registry_syncable.h" |
| 17 #include "components/prefs/pref_registry.h" | 17 #include "components/prefs/pref_registry.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bool plugins_found = false; | 75 bool plugins_found = false; |
| 76 bool cookies_found = false; | 76 bool cookies_found = false; |
| 77 for (const ContentSettingsInfo* info : *registry()) { | 77 for (const ContentSettingsInfo* info : *registry()) { |
| 78 ContentSettingsType type = info->website_settings_info()->type(); | 78 ContentSettingsType type = info->website_settings_info()->type(); |
| 79 std::cout << "##########lshang#########" << type << std::endl; |
| 79 EXPECT_EQ(registry()->Get(type), info); | 80 EXPECT_EQ(registry()->Get(type), info); |
| 80 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { | 81 if (type == CONTENT_SETTINGS_TYPE_PLUGINS) { |
| 81 EXPECT_FALSE(plugins_found); | 82 EXPECT_FALSE(plugins_found); |
| 82 plugins_found = true; | 83 plugins_found = true; |
| 83 } else if (type == CONTENT_SETTINGS_TYPE_COOKIES) { | 84 } else if (type == CONTENT_SETTINGS_TYPE_COOKIES) { |
| 84 EXPECT_FALSE(cookies_found); | 85 EXPECT_FALSE(cookies_found); |
| 85 cookies_found = true; | 86 cookies_found = true; |
| 86 } | 87 } |
| 87 } | 88 } |
| 88 | 89 |
| 90 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 91 EXPECT_FALSE(plugins_found); |
| 92 #else |
| 89 EXPECT_TRUE(plugins_found); | 93 EXPECT_TRUE(plugins_found); |
| 94 #endif |
| 95 |
| 90 EXPECT_TRUE(cookies_found); | 96 EXPECT_TRUE(cookies_found); |
| 91 } | 97 } |
| 92 | 98 |
| 93 } // namespace content_settings | 99 } // namespace content_settings |
| OLD | NEW |