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 3926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3937 .AddExtension(FILE_PATH_LITERAL(".localstorage")); | 3937 .AddExtension(FILE_PATH_LITERAL(".localstorage")); |
3938 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); | 3938 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); |
3939 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); | 3939 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); |
3940 EXPECT_TRUE(file_util::PathExists(lso_file_path)); | 3940 EXPECT_TRUE(file_util::PathExists(lso_file_path)); |
3941 | 3941 |
3942 // Create indexed db. Similarly, it is enough to only simulate this by | 3942 // Create indexed db. Similarly, it is enough to only simulate this by |
3943 // creating the directory on the disk. | 3943 // creating the directory on the disk. |
3944 IndexedDBContext* idb_context = | 3944 IndexedDBContext* idb_context = |
3945 BrowserContext::GetDefaultStoragePartition(profile_.get())-> | 3945 BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
3946 GetIndexedDBContext(); | 3946 GetIndexedDBContext(); |
| 3947 idb_context->SetMessageLoopForTesting(base::MessageLoop::current()); |
3947 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); | 3948 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); |
3948 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); | 3949 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); |
3949 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); | 3950 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); |
3950 | 3951 |
3951 // Uninstall the extension. | 3952 // Uninstall the extension. |
3952 service_->UninstallExtension(good_crx, false, NULL); | 3953 service_->UninstallExtension(good_crx, false, NULL); |
3953 loop_.RunUntilIdle(); | 3954 loop_.RunUntilIdle(); |
3954 | 3955 |
3955 // Check that the cookie is gone. | 3956 // Check that the cookie is gone. |
3956 cookie_monster->GetAllCookiesForURLAsync( | 3957 cookie_monster->GetAllCookiesForURLAsync( |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4052 .AddExtension(FILE_PATH_LITERAL(".localstorage")); | 4053 .AddExtension(FILE_PATH_LITERAL(".localstorage")); |
4053 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); | 4054 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); |
4054 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); | 4055 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); |
4055 EXPECT_TRUE(file_util::PathExists(lso_file_path)); | 4056 EXPECT_TRUE(file_util::PathExists(lso_file_path)); |
4056 | 4057 |
4057 // Create indexed db. Similarly, it is enough to only simulate this by | 4058 // Create indexed db. Similarly, it is enough to only simulate this by |
4058 // creating the directory on the disk. | 4059 // creating the directory on the disk. |
4059 IndexedDBContext* idb_context = | 4060 IndexedDBContext* idb_context = |
4060 BrowserContext::GetDefaultStoragePartition(profile_.get())-> | 4061 BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
4061 GetIndexedDBContext(); | 4062 GetIndexedDBContext(); |
| 4063 idb_context->SetMessageLoopForTesting(base::MessageLoop::current()); |
4062 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); | 4064 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); |
4063 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); | 4065 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); |
4064 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); | 4066 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); |
4065 | 4067 |
4066 // Uninstall one of them, unlimited storage should still be granted | 4068 // Uninstall one of them, unlimited storage should still be granted |
4067 // to the origin. | 4069 // to the origin. |
4068 UninstallExtension(id1, false); | 4070 UninstallExtension(id1, false); |
4069 EXPECT_EQ(1u, service_->extensions()->size()); | 4071 EXPECT_EQ(1u, service_->extensions()->size()); |
4070 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> | 4072 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> |
4071 IsStorageUnlimited(origin1)); | 4073 IsStorageUnlimited(origin1)); |
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6027 new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); | 6029 new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); |
6028 AddMockExternalProvider(provider); | 6030 AddMockExternalProvider(provider); |
6029 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); | 6031 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); |
6030 | 6032 |
6031 service_->CheckForExternalUpdates(); | 6033 service_->CheckForExternalUpdates(); |
6032 loop_.RunUntilIdle(); | 6034 loop_.RunUntilIdle(); |
6033 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); | 6035 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); |
6034 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); | 6036 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); |
6035 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); | 6037 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); |
6036 } | 6038 } |
OLD | NEW |