| 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 "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 3608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3619 // stores data in the host file system. | 3619 // stores data in the host file system. |
| 3620 FilePath lso_dir_path = profile_->GetPath().AppendASCII("Local Storage"); | 3620 FilePath lso_dir_path = profile_->GetPath().AppendASCII("Local Storage"); |
| 3621 FilePath lso_file_path = lso_dir_path.AppendASCII( | 3621 FilePath lso_file_path = lso_dir_path.AppendASCII( |
| 3622 UTF16ToUTF8(origin_id) + ".localstorage"); | 3622 UTF16ToUTF8(origin_id) + ".localstorage"); |
| 3623 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); | 3623 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); |
| 3624 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); | 3624 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); |
| 3625 EXPECT_TRUE(file_util::PathExists(lso_file_path)); | 3625 EXPECT_TRUE(file_util::PathExists(lso_file_path)); |
| 3626 | 3626 |
| 3627 // Create indexed db. Similarly, it is enough to only simulate this by | 3627 // Create indexed db. Similarly, it is enough to only simulate this by |
| 3628 // creating the directory on the disk. | 3628 // creating the directory on the disk. |
| 3629 IndexedDBContext* idb_context = BrowserContext::GetIndexedDBContext( | 3629 IndexedDBContext* idb_context = |
| 3630 profile_.get()); | 3630 BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
| 3631 GetIndexedDBContext(); |
| 3631 FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); | 3632 FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); |
| 3632 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); | 3633 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); |
| 3633 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); | 3634 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); |
| 3634 | 3635 |
| 3635 // Uninstall the extension. | 3636 // Uninstall the extension. |
| 3636 service_->UninstallExtension(good_crx, false, NULL); | 3637 service_->UninstallExtension(good_crx, false, NULL); |
| 3637 loop_.RunAllPending(); | 3638 loop_.RunAllPending(); |
| 3638 | 3639 |
| 3639 // Check that the cookie is gone. | 3640 // Check that the cookie is gone. |
| 3640 cookie_monster->GetAllCookiesForURLAsync( | 3641 cookie_monster->GetAllCookiesForURLAsync( |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3731 // stores data in the host file system. | 3732 // stores data in the host file system. |
| 3732 FilePath lso_dir_path = profile_->GetPath().AppendASCII("Local Storage"); | 3733 FilePath lso_dir_path = profile_->GetPath().AppendASCII("Local Storage"); |
| 3733 FilePath lso_file_path = lso_dir_path.AppendASCII( | 3734 FilePath lso_file_path = lso_dir_path.AppendASCII( |
| 3734 UTF16ToUTF8(origin_id) + ".localstorage"); | 3735 UTF16ToUTF8(origin_id) + ".localstorage"); |
| 3735 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); | 3736 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); |
| 3736 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); | 3737 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); |
| 3737 EXPECT_TRUE(file_util::PathExists(lso_file_path)); | 3738 EXPECT_TRUE(file_util::PathExists(lso_file_path)); |
| 3738 | 3739 |
| 3739 // Create indexed db. Similarly, it is enough to only simulate this by | 3740 // Create indexed db. Similarly, it is enough to only simulate this by |
| 3740 // creating the directory on the disk. | 3741 // creating the directory on the disk. |
| 3741 IndexedDBContext* idb_context = BrowserContext::GetIndexedDBContext( | 3742 IndexedDBContext* idb_context = |
| 3742 profile_.get()); | 3743 BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
| 3744 GetIndexedDBContext(); |
| 3743 FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); | 3745 FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); |
| 3744 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); | 3746 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); |
| 3745 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); | 3747 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); |
| 3746 | 3748 |
| 3747 // Uninstall one of them, unlimited storage should still be granted | 3749 // Uninstall one of them, unlimited storage should still be granted |
| 3748 // to the origin. | 3750 // to the origin. |
| 3749 UninstallExtension(id1, false); | 3751 UninstallExtension(id1, false); |
| 3750 EXPECT_EQ(1u, service_->extensions()->size()); | 3752 EXPECT_EQ(1u, service_->extensions()->size()); |
| 3751 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> | 3753 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> |
| 3752 IsStorageUnlimited(origin1)); | 3754 IsStorageUnlimited(origin1)); |
| (...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5530 // This should NOT trigger an alert. | 5532 // This should NOT trigger an alert. |
| 5531 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", | 5533 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", |
| 5532 data_dir_.AppendASCII("hosted_app.crx")); | 5534 data_dir_.AppendASCII("hosted_app.crx")); |
| 5533 | 5535 |
| 5534 service_->CheckForExternalUpdates(); | 5536 service_->CheckForExternalUpdates(); |
| 5535 loop_.RunAllPending(); | 5537 loop_.RunAllPending(); |
| 5536 | 5538 |
| 5537 ASSERT_TRUE(service_->PopulateExtensionErrorUI(extension_error_ui.get())); | 5539 ASSERT_TRUE(service_->PopulateExtensionErrorUI(extension_error_ui.get())); |
| 5538 ASSERT_EQ(1u, extension_error_ui->get_external_extension_ids()->size()); | 5540 ASSERT_EQ(1u, extension_error_ui->get_external_extension_ids()->size()); |
| 5539 } | 5541 } |
| OLD | NEW |