| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 file_util::Delete(extensions_install_dir_, true); | 447 file_util::Delete(extensions_install_dir_, true); |
| 448 file_util::CopyDirectory(source_install_dir, extensions_install_dir_, true); | 448 file_util::CopyDirectory(source_install_dir, extensions_install_dir_, true); |
| 449 | 449 |
| 450 InitializeExtensionService(temp_prefs, extensions_install_dir_, false); | 450 InitializeExtensionService(temp_prefs, extensions_install_dir_, false); |
| 451 } | 451 } |
| 452 | 452 |
| 453 void ExtensionServiceTestBase::InitializeEmptyExtensionService() { | 453 void ExtensionServiceTestBase::InitializeEmptyExtensionService() { |
| 454 InitializeExtensionServiceHelper(false); | 454 InitializeExtensionServiceHelper(false); |
| 455 } | 455 } |
| 456 | 456 |
| 457 void ExtensionServiceTestBase::InitializeExtensionProcessManager() { |
| 458 profile_->CreateExtensionProcessManager(); |
| 459 } |
| 460 |
| 457 void ExtensionServiceTestBase::InitializeExtensionServiceWithUpdater() { | 461 void ExtensionServiceTestBase::InitializeExtensionServiceWithUpdater() { |
| 458 InitializeExtensionServiceHelper(true); | 462 InitializeExtensionServiceHelper(true); |
| 459 service_->updater()->Start(); | 463 service_->updater()->Start(); |
| 460 } | 464 } |
| 461 | 465 |
| 462 void ExtensionServiceTestBase::InitializeExtensionServiceHelper( | 466 void ExtensionServiceTestBase::InitializeExtensionServiceHelper( |
| 463 bool autoupdate_enabled) { | 467 bool autoupdate_enabled) { |
| 464 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 468 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 465 FilePath path_ = temp_dir_.path(); | 469 FilePath path_ = temp_dir_.path(); |
| 466 path_ = path_.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); | 470 path_ = path_.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); |
| (...skipping 3497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3964 list[0] = sync_change; | 3968 list[0] = sync_change; |
| 3965 | 3969 |
| 3966 // Should again do nothing. | 3970 // Should again do nothing. |
| 3967 service_->ProcessSyncChanges(FROM_HERE, list); | 3971 service_->ProcessSyncChanges(FROM_HERE, list); |
| 3968 EXPECT_TRUE(service_->GetExtensionById(good_crx, false)); | 3972 EXPECT_TRUE(service_->GetExtensionById(good_crx, false)); |
| 3969 } | 3973 } |
| 3970 } | 3974 } |
| 3971 | 3975 |
| 3972 TEST_F(ExtensionServiceTest, ProcessSyncDataSettings) { | 3976 TEST_F(ExtensionServiceTest, ProcessSyncDataSettings) { |
| 3973 InitializeEmptyExtensionService(); | 3977 InitializeEmptyExtensionService(); |
| 3978 InitializeExtensionProcessManager(); |
| 3974 TestSyncProcessorStub processor; | 3979 TestSyncProcessorStub processor; |
| 3975 service_->MergeDataAndStartSyncing(syncable::EXTENSIONS, SyncDataList(), | 3980 service_->MergeDataAndStartSyncing(syncable::EXTENSIONS, SyncDataList(), |
| 3976 &processor); | 3981 &processor); |
| 3977 | 3982 |
| 3978 InstallCrx(data_dir_.AppendASCII("good.crx"), true); | 3983 InstallCrx(data_dir_.AppendASCII("good.crx"), true); |
| 3979 EXPECT_TRUE(service_->IsExtensionEnabled(good_crx)); | 3984 EXPECT_TRUE(service_->IsExtensionEnabled(good_crx)); |
| 3980 EXPECT_FALSE(service_->IsIncognitoEnabled(good_crx)); | 3985 EXPECT_FALSE(service_->IsIncognitoEnabled(good_crx)); |
| 3981 | 3986 |
| 3982 sync_pb::EntitySpecifics specifics; | 3987 sync_pb::EntitySpecifics specifics; |
| 3983 sync_pb::ExtensionSpecifics* ext_specifics = | 3988 sync_pb::ExtensionSpecifics* ext_specifics = |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4321 ASSERT_FALSE(AddPendingSyncInstall()); | 4326 ASSERT_FALSE(AddPendingSyncInstall()); |
| 4322 | 4327 |
| 4323 // Wait for the external source to install. | 4328 // Wait for the external source to install. |
| 4324 WaitForCrxInstall(crx_path_, true); | 4329 WaitForCrxInstall(crx_path_, true); |
| 4325 ASSERT_TRUE(IsCrxInstalled()); | 4330 ASSERT_TRUE(IsCrxInstalled()); |
| 4326 | 4331 |
| 4327 // Now that the extension is installed, sync request should fail | 4332 // Now that the extension is installed, sync request should fail |
| 4328 // because the extension is already installed. | 4333 // because the extension is already installed. |
| 4329 ASSERT_FALSE(AddPendingSyncInstall()); | 4334 ASSERT_FALSE(AddPendingSyncInstall()); |
| 4330 } | 4335 } |
| OLD | NEW |