| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 return service; | 547 return service; |
| 548 } | 548 } |
| 549 | 549 |
| 550 void ExtensionServiceTestBase::InitializeInstalledExtensionService( | 550 void ExtensionServiceTestBase::InitializeInstalledExtensionService( |
| 551 const base::FilePath& prefs_file, | 551 const base::FilePath& prefs_file, |
| 552 const base::FilePath& source_install_dir) { | 552 const base::FilePath& source_install_dir) { |
| 553 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); | 553 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 554 base::FilePath path = temp_dir_.path(); | 554 base::FilePath path = temp_dir_.path(); |
| 555 path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); | 555 path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); |
| 556 EXPECT_TRUE(base::DeleteFile(path, true)); | 556 EXPECT_TRUE(base::DeleteFile(path, true)); |
| 557 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 557 base::File::Error error = base::File::FILE_OK; |
| 558 EXPECT_TRUE(base::CreateDirectoryAndGetError(path, &error)) << error; | 558 EXPECT_TRUE(base::CreateDirectoryAndGetError(path, &error)) << error; |
| 559 base::FilePath temp_prefs = path.Append(FILE_PATH_LITERAL("Preferences")); | 559 base::FilePath temp_prefs = path.Append(FILE_PATH_LITERAL("Preferences")); |
| 560 EXPECT_TRUE(base::CopyFile(prefs_file, temp_prefs)); | 560 EXPECT_TRUE(base::CopyFile(prefs_file, temp_prefs)); |
| 561 | 561 |
| 562 base::FilePath extensions_install_dir = | 562 base::FilePath extensions_install_dir = |
| 563 path.Append(FILE_PATH_LITERAL("Extensions")); | 563 path.Append(FILE_PATH_LITERAL("Extensions")); |
| 564 EXPECT_TRUE(base::DeleteFile(extensions_install_dir, true)); | 564 EXPECT_TRUE(base::DeleteFile(extensions_install_dir, true)); |
| 565 EXPECT_TRUE( | 565 EXPECT_TRUE( |
| 566 base::CopyDirectory(source_install_dir, extensions_install_dir, true)); | 566 base::CopyDirectory(source_install_dir, extensions_install_dir, true)); |
| 567 | 567 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 | 625 |
| 626 // static | 626 // static |
| 627 ExtensionServiceTestBase::ExtensionServiceInitParams | 627 ExtensionServiceTestBase::ExtensionServiceInitParams |
| 628 ExtensionServiceTestBase::CreateDefaultInitParamsInTempDir( | 628 ExtensionServiceTestBase::CreateDefaultInitParamsInTempDir( |
| 629 base::ScopedTempDir* temp_dir) { | 629 base::ScopedTempDir* temp_dir) { |
| 630 ExtensionServiceInitParams params; | 630 ExtensionServiceInitParams params; |
| 631 EXPECT_TRUE(temp_dir->CreateUniqueTempDir()); | 631 EXPECT_TRUE(temp_dir->CreateUniqueTempDir()); |
| 632 base::FilePath path = temp_dir->path(); | 632 base::FilePath path = temp_dir->path(); |
| 633 path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); | 633 path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); |
| 634 EXPECT_TRUE(base::DeleteFile(path, true)); | 634 EXPECT_TRUE(base::DeleteFile(path, true)); |
| 635 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 635 base::File::Error error = base::File::FILE_OK; |
| 636 EXPECT_TRUE(base::CreateDirectoryAndGetError(path, &error)) << error; | 636 EXPECT_TRUE(base::CreateDirectoryAndGetError(path, &error)) << error; |
| 637 base::FilePath prefs_filename = | 637 base::FilePath prefs_filename = |
| 638 path.Append(FILE_PATH_LITERAL("TestPreferences")); | 638 path.Append(FILE_PATH_LITERAL("TestPreferences")); |
| 639 base::FilePath extensions_install_dir = | 639 base::FilePath extensions_install_dir = |
| 640 path.Append(FILE_PATH_LITERAL("Extensions")); | 640 path.Append(FILE_PATH_LITERAL("Extensions")); |
| 641 EXPECT_TRUE(base::DeleteFile(extensions_install_dir, true)); | 641 EXPECT_TRUE(base::DeleteFile(extensions_install_dir, true)); |
| 642 EXPECT_TRUE(base::CreateDirectoryAndGetError(extensions_install_dir, | 642 EXPECT_TRUE(base::CreateDirectoryAndGetError(extensions_install_dir, |
| 643 &error)) << error; | 643 &error)) << error; |
| 644 | 644 |
| 645 params.profile_path = path; | 645 params.profile_path = path; |
| (...skipping 6134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6780 // ReconcileKnownDisabled(). | 6780 // ReconcileKnownDisabled(). |
| 6781 service_->EnableExtension(good2); | 6781 service_->EnableExtension(good2); |
| 6782 service_->ReconcileKnownDisabled(); | 6782 service_->ReconcileKnownDisabled(); |
| 6783 expected_extensions.insert(good2); | 6783 expected_extensions.insert(good2); |
| 6784 expected_disabled_extensions.erase(good2); | 6784 expected_disabled_extensions.erase(good2); |
| 6785 | 6785 |
| 6786 EXPECT_EQ(expected_extensions, service_->extensions()->GetIDs()); | 6786 EXPECT_EQ(expected_extensions, service_->extensions()->GetIDs()); |
| 6787 EXPECT_EQ(expected_disabled_extensions, | 6787 EXPECT_EQ(expected_disabled_extensions, |
| 6788 service_->disabled_extensions()->GetIDs()); | 6788 service_->disabled_extensions()->GetIDs()); |
| 6789 } | 6789 } |
| OLD | NEW |