| 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 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 4289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4300 EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); | 4300 EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); |
| 4301 EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); | 4301 EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); |
| 4302 EXPECT_TRUE(base::PathExists(lso_file_path)); | 4302 EXPECT_TRUE(base::PathExists(lso_file_path)); |
| 4303 | 4303 |
| 4304 // Create indexed db. Similarly, it is enough to only simulate this by | 4304 // Create indexed db. Similarly, it is enough to only simulate this by |
| 4305 // creating the directory on the disk. | 4305 // creating the directory on the disk. |
| 4306 IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( | 4306 IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( |
| 4307 profile())->GetIndexedDBContext(); | 4307 profile())->GetIndexedDBContext(); |
| 4308 idb_context->SetTaskRunnerForTesting( | 4308 idb_context->SetTaskRunnerForTesting( |
| 4309 base::MessageLoop::current()->task_runner().get()); | 4309 base::MessageLoop::current()->task_runner().get()); |
| 4310 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); | 4310 base::FilePath idb_path = idb_context->GetFilePathForTesting(ext_url); |
| 4311 EXPECT_TRUE(base::CreateDirectory(idb_path)); | 4311 EXPECT_TRUE(base::CreateDirectory(idb_path)); |
| 4312 EXPECT_TRUE(base::DirectoryExists(idb_path)); | 4312 EXPECT_TRUE(base::DirectoryExists(idb_path)); |
| 4313 | 4313 |
| 4314 // Uninstall the extension. | 4314 // Uninstall the extension. |
| 4315 base::RunLoop run_loop; | 4315 base::RunLoop run_loop; |
| 4316 ASSERT_TRUE( | 4316 ASSERT_TRUE( |
| 4317 service()->UninstallExtension(good_crx, | 4317 service()->UninstallExtension(good_crx, |
| 4318 extensions::UNINSTALL_REASON_FOR_TESTING, | 4318 extensions::UNINSTALL_REASON_FOR_TESTING, |
| 4319 run_loop.QuitClosure(), | 4319 run_loop.QuitClosure(), |
| 4320 NULL)); | 4320 NULL)); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4421 EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); | 4421 EXPECT_TRUE(base::CreateDirectory(lso_dir_path)); |
| 4422 EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); | 4422 EXPECT_EQ(0, base::WriteFile(lso_file_path, NULL, 0)); |
| 4423 EXPECT_TRUE(base::PathExists(lso_file_path)); | 4423 EXPECT_TRUE(base::PathExists(lso_file_path)); |
| 4424 | 4424 |
| 4425 // Create indexed db. Similarly, it is enough to only simulate this by | 4425 // Create indexed db. Similarly, it is enough to only simulate this by |
| 4426 // creating the directory on the disk. | 4426 // creating the directory on the disk. |
| 4427 IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( | 4427 IndexedDBContext* idb_context = BrowserContext::GetDefaultStoragePartition( |
| 4428 profile())->GetIndexedDBContext(); | 4428 profile())->GetIndexedDBContext(); |
| 4429 idb_context->SetTaskRunnerForTesting( | 4429 idb_context->SetTaskRunnerForTesting( |
| 4430 base::MessageLoop::current()->task_runner().get()); | 4430 base::MessageLoop::current()->task_runner().get()); |
| 4431 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); | 4431 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin1); |
| 4432 EXPECT_TRUE(base::CreateDirectory(idb_path)); | 4432 EXPECT_TRUE(base::CreateDirectory(idb_path)); |
| 4433 EXPECT_TRUE(base::DirectoryExists(idb_path)); | 4433 EXPECT_TRUE(base::DirectoryExists(idb_path)); |
| 4434 | 4434 |
| 4435 // Uninstall one of them, unlimited storage should still be granted | 4435 // Uninstall one of them, unlimited storage should still be granted |
| 4436 // to the origin. | 4436 // to the origin. |
| 4437 UninstallExtension(id1, false); | 4437 UninstallExtension(id1, false); |
| 4438 EXPECT_EQ(1u, registry()->enabled_extensions().size()); | 4438 EXPECT_EQ(1u, registry()->enabled_extensions().size()); |
| 4439 EXPECT_TRUE(profile()->GetExtensionSpecialStoragePolicy()->IsStorageUnlimited( | 4439 EXPECT_TRUE(profile()->GetExtensionSpecialStoragePolicy()->IsStorageUnlimited( |
| 4440 origin1)); | 4440 origin1)); |
| 4441 | 4441 |
| (...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6276 | 6276 |
| 6277 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 6277 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
| 6278 content::Source<Profile>(profile()), | 6278 content::Source<Profile>(profile()), |
| 6279 content::NotificationService::NoDetails()); | 6279 content::NotificationService::NoDetails()); |
| 6280 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 6280 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
| 6281 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 6281 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 6282 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 6282 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
| 6283 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 6283 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
| 6284 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 6284 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
| 6285 } | 6285 } |
| OLD | NEW |