| 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.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 4614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4625 base::FilePath lso_file_path = lso_dir_path.AppendASCII(origin_id) | 4625 base::FilePath lso_file_path = lso_dir_path.AppendASCII(origin_id) |
| 4626 .AddExtension(FILE_PATH_LITERAL(".localstorage")); | 4626 .AddExtension(FILE_PATH_LITERAL(".localstorage")); |
| 4627 EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); | 4627 EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); |
| 4628 EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); | 4628 EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); |
| 4629 EXPECT_TRUE(base::PathExists(lso_file_path)); | 4629 EXPECT_TRUE(base::PathExists(lso_file_path)); |
| 4630 | 4630 |
| 4631 // Create indexed db. Similarly, it is enough to only simulate this by | 4631 // Create indexed db. Similarly, it is enough to only simulate this by |
| 4632 // creating the directory on the disk. | 4632 // creating the directory on the disk. |
| 4633 IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( | 4633 IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( |
| 4634 profile())->GetIndexedDBContext(); | 4634 profile())->GetIndexedDBContext(); |
| 4635 idb_context->SetTaskRunnerForTesting( | 4635 idb_context->SetTaskRunnerForTesting(base::ThreadTaskRunnerHandle::Get()); |
| 4636 base::ThreadTaskRunnerHandle::Get().get()); | |
| 4637 base::FilePath idb_path = idb_context->GetFilePathForTesting(ext_url); | 4636 base::FilePath idb_path = idb_context->GetFilePathForTesting(ext_url); |
| 4638 EXPECT_TRUE(base::CreateDirectory(idb_path)); | 4637 EXPECT_TRUE(base::CreateDirectory(idb_path)); |
| 4639 EXPECT_TRUE(base::DirectoryExists(idb_path)); | 4638 EXPECT_TRUE(base::DirectoryExists(idb_path)); |
| 4640 | 4639 |
| 4641 // Uninstall the extension. | 4640 // Uninstall the extension. |
| 4642 base::RunLoop run_loop; | 4641 base::RunLoop run_loop; |
| 4643 ASSERT_TRUE( | 4642 ASSERT_TRUE( |
| 4644 service()->UninstallExtension(good_crx, | 4643 service()->UninstallExtension(good_crx, |
| 4645 extensions::UNINSTALL_REASON_FOR_TESTING, | 4644 extensions::UNINSTALL_REASON_FOR_TESTING, |
| 4646 run_loop.QuitClosure(), | 4645 run_loop.QuitClosure(), |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4746 base::FilePath lso_file_path = lso_dir_path.AppendASCII(origin_id) | 4745 base::FilePath lso_file_path = lso_dir_path.AppendASCII(origin_id) |
| 4747 .AddExtension(FILE_PATH_LITERAL(".localstorage")); | 4746 .AddExtension(FILE_PATH_LITERAL(".localstorage")); |
| 4748 EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); | 4747 EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); |
| 4749 EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); | 4748 EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); |
| 4750 EXPECT_TRUE(base::PathExists(lso_file_path)); | 4749 EXPECT_TRUE(base::PathExists(lso_file_path)); |
| 4751 | 4750 |
| 4752 // Create indexed db. Similarly, it is enough to only simulate this by | 4751 // Create indexed db. Similarly, it is enough to only simulate this by |
| 4753 // creating the directory on the disk. | 4752 // creating the directory on the disk. |
| 4754 IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( | 4753 IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( |
| 4755 profile())->GetIndexedDBContext(); | 4754 profile())->GetIndexedDBContext(); |
| 4756 idb_context->SetTaskRunnerForTesting( | 4755 idb_context->SetTaskRunnerForTesting(base::ThreadTaskRunnerHandle::Get()); |
| 4757 base::ThreadTaskRunnerHandle::Get().get()); | |
| 4758 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin1); | 4756 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin1); |
| 4759 EXPECT_TRUE(base::CreateDirectory(idb_path)); | 4757 EXPECT_TRUE(base::CreateDirectory(idb_path)); |
| 4760 EXPECT_TRUE(base::DirectoryExists(idb_path)); | 4758 EXPECT_TRUE(base::DirectoryExists(idb_path)); |
| 4761 | 4759 |
| 4762 // Uninstall one of them, unlimited storage should still be granted | 4760 // Uninstall one of them, unlimited storage should still be granted |
| 4763 // to the origin. | 4761 // to the origin. |
| 4764 UninstallExtension(id1, false); | 4762 UninstallExtension(id1, false); |
| 4765 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | 4763 EXPECT_EQ(1u, registry()->enabled_extensions().size()); |
| 4766 EXPECT_TRUE(profile()->GetExtensionSpecialStoragePolicy()->IsStorageUnlimited( | 4764 EXPECT_TRUE(profile()->GetExtensionSpecialStoragePolicy()->IsStorageUnlimited( |
| 4767 origin1)); | 4765 origin1)); |
| (...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6944 shared_module->manifest()->type()); | 6942 shared_module->manifest()->type()); |
| 6945 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); | 6943 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); |
| 6946 | 6944 |
| 6947 // Reload the extension and wait for it to complete. This previously crashed | 6945 // Reload the extension and wait for it to complete. This previously crashed |
| 6948 // (see crbug.com/676815). | 6946 // (see crbug.com/676815). |
| 6949 service()->ReloadExtension(kExtensionId); | 6947 service()->ReloadExtension(kExtensionId); |
| 6950 content::RunAllBlockingPoolTasksUntilIdle(); | 6948 content::RunAllBlockingPoolTasksUntilIdle(); |
| 6951 // The shared module should be enabled. | 6949 // The shared module should be enabled. |
| 6952 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); | 6950 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); |
| 6953 } | 6951 } |
| OLD | NEW |