| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 } | 1832 } |
| 1833 | 1833 |
| 1834 TEST_F(ExtensionServiceSyncTest, SyncExtensionHasAllhostsWithheld) { | 1834 TEST_F(ExtensionServiceSyncTest, SyncExtensionHasAllhostsWithheld) { |
| 1835 InitializeEmptyExtensionService(); | 1835 InitializeEmptyExtensionService(); |
| 1836 | 1836 |
| 1837 // Create an extension that needs all-hosts. | 1837 // Create an extension that needs all-hosts. |
| 1838 const std::string kName("extension"); | 1838 const std::string kName("extension"); |
| 1839 scoped_refptr<const Extension> extension = | 1839 scoped_refptr<const Extension> extension = |
| 1840 extensions::ExtensionBuilder() | 1840 extensions::ExtensionBuilder() |
| 1841 .SetLocation(Manifest::INTERNAL) | 1841 .SetLocation(Manifest::INTERNAL) |
| 1842 .SetManifest(std::move( | 1842 .SetManifest( |
| 1843 extensions::DictionaryBuilder() | 1843 extensions::DictionaryBuilder() |
| 1844 .Set("name", kName) | 1844 .Set("name", kName) |
| 1845 .Set("description", "foo") | 1845 .Set("description", "foo") |
| 1846 .Set("manifest_version", 2) | 1846 .Set("manifest_version", 2) |
| 1847 .Set("version", "1.0") | 1847 .Set("version", "1.0") |
| 1848 .Set("permissions", | 1848 .Set("permissions", |
| 1849 std::move(extensions::ListBuilder().Append("*://*/*"))))) | 1849 extensions::ListBuilder().Append("*://*/*").Build()) |
| 1850 .Build()) |
| 1850 .SetID(crx_file::id_util::GenerateId(kName)) | 1851 .SetID(crx_file::id_util::GenerateId(kName)) |
| 1851 .Build(); | 1852 .Build(); |
| 1852 | 1853 |
| 1853 // Install and enable it. | 1854 // Install and enable it. |
| 1854 service()->AddExtension(extension.get()); | 1855 service()->AddExtension(extension.get()); |
| 1855 service()->GrantPermissionsAndEnableExtension(extension.get()); | 1856 service()->GrantPermissionsAndEnableExtension(extension.get()); |
| 1856 const std::string id = extension->id(); | 1857 const std::string id = extension->id(); |
| 1857 EXPECT_TRUE(registry()->enabled_extensions().GetByID(id)); | 1858 EXPECT_TRUE(registry()->enabled_extensions().GetByID(id)); |
| 1858 | 1859 |
| 1859 // Simulate a sync node coming in where the extension had all-hosts withheld. | 1860 // Simulate a sync node coming in where the extension had all-hosts withheld. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1871 | 1872 |
| 1872 extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); | 1873 extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); |
| 1873 | 1874 |
| 1874 EXPECT_TRUE(registry()->enabled_extensions().GetByID(id)); | 1875 EXPECT_TRUE(registry()->enabled_extensions().GetByID(id)); |
| 1875 EXPECT_FALSE(extensions::util::AllowedScriptingOnAllUrls(id, profile())); | 1876 EXPECT_FALSE(extensions::util::AllowedScriptingOnAllUrls(id, profile())); |
| 1876 EXPECT_TRUE(extensions::util::HasSetAllowedScriptingOnAllUrls(id, profile())); | 1877 EXPECT_TRUE(extensions::util::HasSetAllowedScriptingOnAllUrls(id, profile())); |
| 1877 EXPECT_FALSE(extensions::util::AllowedScriptingOnAllUrls(id, profile())); | 1878 EXPECT_FALSE(extensions::util::AllowedScriptingOnAllUrls(id, profile())); |
| 1878 } | 1879 } |
| 1879 | 1880 |
| 1880 #endif // defined(ENABLE_SUPERVISED_USERS) | 1881 #endif // defined(ENABLE_SUPERVISED_USERS) |
| OLD | NEW |