OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/ptr_util.h" |
9 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
10 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/extensions/extension_browsertest.h" | 12 #include "chrome/browser/extensions/extension_browsertest.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/extensions/extension_sync_data.h" | 14 #include "chrome/browser/extensions/extension_sync_data.h" |
14 #include "chrome/browser/extensions/extension_sync_service.h" | 15 #include "chrome/browser/extensions/extension_sync_service.h" |
15 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 16 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
16 #include "chrome/browser/extensions/updater/extension_updater.h" | 17 #include "chrome/browser/extensions/updater/extension_updater.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 interceptor.SetResponseIgnoreQuery( | 211 interceptor.SetResponseIgnoreQuery( |
211 GURL("http://localhost/autoupdate/updates.xml"), | 212 GURL("http://localhost/autoupdate/updates.xml"), |
212 test_data_dir_.AppendASCII("permissions_increase") | 213 test_data_dir_.AppendASCII("permissions_increase") |
213 .AppendASCII("updates.xml")); | 214 .AppendASCII("updates.xml")); |
214 interceptor.SetResponseIgnoreQuery( | 215 interceptor.SetResponseIgnoreQuery( |
215 GURL("http://localhost/autoupdate/v2.crx"), | 216 GURL("http://localhost/autoupdate/v2.crx"), |
216 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); | 217 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); |
217 | 218 |
218 sync_service->MergeDataAndStartSyncing( | 219 sync_service->MergeDataAndStartSyncing( |
219 syncer::EXTENSIONS, syncer::SyncDataList(), | 220 syncer::EXTENSIONS, syncer::SyncDataList(), |
220 make_scoped_ptr(new syncer::FakeSyncChangeProcessor()), | 221 base::WrapUnique(new syncer::FakeSyncChangeProcessor()), |
221 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); | 222 base::WrapUnique(new syncer::SyncErrorFactoryMock())); |
222 extensions::TestExtensionRegistryObserver install_observer(registry_); | 223 extensions::TestExtensionRegistryObserver install_observer(registry_); |
223 sync_service->ProcessSyncChanges( | 224 sync_service->ProcessSyncChanges( |
224 FROM_HERE, | 225 FROM_HERE, |
225 syncer::SyncChangeList( | 226 syncer::SyncChangeList( |
226 1, sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD))); | 227 1, sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD))); |
227 | 228 |
228 install_observer.WaitForExtensionWillBeInstalled(); | 229 install_observer.WaitForExtensionWillBeInstalled(); |
229 content::RunAllBlockingPoolTasksUntilIdle(); | 230 content::RunAllBlockingPoolTasksUntilIdle(); |
230 | 231 |
231 extension = service_->GetExtensionById(extension_id, true); | 232 extension = service_->GetExtensionById(extension_id, true); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 syncer::SyncData sync_data = | 268 syncer::SyncData sync_data = |
268 syncer::SyncData::CreateRemoteData(1234567, | 269 syncer::SyncData::CreateRemoteData(1234567, |
269 specifics, | 270 specifics, |
270 base::Time::Now(), | 271 base::Time::Now(), |
271 syncer::AttachmentIdList(), | 272 syncer::AttachmentIdList(), |
272 syncer::AttachmentServiceProxy()); | 273 syncer::AttachmentServiceProxy()); |
273 | 274 |
274 ExtensionSyncService* sync_service = ExtensionSyncService::Get(profile()); | 275 ExtensionSyncService* sync_service = ExtensionSyncService::Get(profile()); |
275 sync_service->MergeDataAndStartSyncing( | 276 sync_service->MergeDataAndStartSyncing( |
276 syncer::EXTENSIONS, syncer::SyncDataList(), | 277 syncer::EXTENSIONS, syncer::SyncDataList(), |
277 make_scoped_ptr(new syncer::FakeSyncChangeProcessor()), | 278 base::WrapUnique(new syncer::FakeSyncChangeProcessor()), |
278 make_scoped_ptr(new syncer::SyncErrorFactoryMock())); | 279 base::WrapUnique(new syncer::SyncErrorFactoryMock())); |
279 extensions::TestExtensionRegistryObserver install_observer(registry_); | 280 extensions::TestExtensionRegistryObserver install_observer(registry_); |
280 sync_service->ProcessSyncChanges( | 281 sync_service->ProcessSyncChanges( |
281 FROM_HERE, | 282 FROM_HERE, |
282 syncer::SyncChangeList( | 283 syncer::SyncChangeList( |
283 1, syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD, | 284 1, syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD, |
284 sync_data))); | 285 sync_data))); |
285 | 286 |
286 install_observer.WaitForExtensionWillBeInstalled(); | 287 install_observer.WaitForExtensionWillBeInstalled(); |
287 content::RunAllBlockingPoolTasksUntilIdle(); | 288 content::RunAllBlockingPoolTasksUntilIdle(); |
288 | 289 |
289 const Extension* extension = service_->GetExtensionById(extension_id, true); | 290 const Extension* extension = service_->GetExtensionById(extension_id, true); |
290 ASSERT_TRUE(extension); | 291 ASSERT_TRUE(extension); |
291 EXPECT_EQ("2", extension->VersionString()); | 292 EXPECT_EQ("2", extension->VersionString()); |
292 EXPECT_EQ(1u, registry_->disabled_extensions().size()); | 293 EXPECT_EQ(1u, registry_->disabled_extensions().size()); |
293 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, | 294 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, |
294 ExtensionPrefs::Get(service_->profile()) | 295 ExtensionPrefs::Get(service_->profile()) |
295 ->GetDisableReasons(extension_id)); | 296 ->GetDisableReasons(extension_id)); |
296 EXPECT_TRUE(GetExtensionDisabledGlobalError()); | 297 EXPECT_TRUE(GetExtensionDisabledGlobalError()); |
297 } | 298 } |
OLD | NEW |