Chromium Code Reviews| Index: chrome/browser/extensions/extension_service_sync_unittest.cc |
| diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc |
| index 8e9ac8d150782cd6541ad382d8d1def162acb17d..211c5d304e415bc9cac2bd788eb740d9c19a91db 100644 |
| --- a/chrome/browser/extensions/extension_service_sync_unittest.cc |
| +++ b/chrome/browser/extensions/extension_service_sync_unittest.cc |
| @@ -1684,6 +1684,39 @@ TEST_F(ExtensionServiceTestSupervised, PreinstalledExtension) { |
| EXPECT_FALSE(registry()->enabled_extensions().Contains(id)); |
| } |
| +TEST_F(ExtensionServiceTestSupervised, DelegatedAndPreinstalledExtension) { |
| + InitServices(false /* profile_is_supervised */); |
| + |
| + // Install an extension. |
| + base::FilePath path = data_dir().AppendASCII("good.crx"); |
| + const Extension* extension = InstallCRX(path, INSTALL_NEW); |
| + std::string id = extension->id(); |
| + const std::string version("1.0.0.0"); |
| + |
| + // It should be enabled. |
| + EXPECT_TRUE(registry()->enabled_extensions().Contains(id)); |
| + |
| + sync_pb::EntitySpecifics specifics; |
|
Marc Treib
2016/06/13 09:37:13
Add a comment about what this does please.
mamir
2016/06/13 11:30:16
Done.
|
| + sync_pb::ExtensionSpecifics* ext_specifics = specifics.mutable_extension(); |
| + ext_specifics->set_id(id); |
| + ext_specifics->set_enabled(true); |
| + ext_specifics->set_disable_reasons(Extension::DISABLE_NONE); |
| + ext_specifics->set_installed_by_custodian(true); |
| + ext_specifics->set_version(version); |
| + |
| + SyncChangeList list = |
| + MakeSyncChangeList(id, specifics, SyncChange::ACTION_UPDATE); |
| + |
| + extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); |
| + |
| + // Now make the profile supervised. |
|
Marc Treib
2016/06/13 09:37:14
What about the other way around - first it becomes
mamir
2016/06/13 11:30:16
Done.
|
| + profile()->AsTestingProfile()->SetSupervisedUserId( |
| + supervised_users::kChildAccountSUID); |
| + |
| + // The extension should be enabled. |
| + EXPECT_TRUE(registry()->enabled_extensions().Contains(id)); |
|
Marc Treib
2016/06/13 09:37:14
Also check that is has the installed_by_custodian
mamir
2016/06/13 11:30:16
Done.
|
| +} |
| + |
| TEST_F(ExtensionServiceTestSupervised, UpdateWithoutPermissionIncrease) { |
| InitServices(true /* profile_is_supervised */); |