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 3989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4000 .AddExtension(FILE_PATH_LITERAL(".localstorage")); | 4000 .AddExtension(FILE_PATH_LITERAL(".localstorage")); |
4001 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); | 4001 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); |
4002 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); | 4002 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); |
4003 EXPECT_TRUE(file_util::PathExists(lso_file_path)); | 4003 EXPECT_TRUE(file_util::PathExists(lso_file_path)); |
4004 | 4004 |
4005 // Create indexed db. Similarly, it is enough to only simulate this by | 4005 // Create indexed db. Similarly, it is enough to only simulate this by |
4006 // creating the directory on the disk. | 4006 // creating the directory on the disk. |
4007 IndexedDBContext* idb_context = | 4007 IndexedDBContext* idb_context = |
4008 BrowserContext::GetDefaultStoragePartition(profile_.get())-> | 4008 BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
4009 GetIndexedDBContext(); | 4009 GetIndexedDBContext(); |
| 4010 idb_context->SetTaskRunnerForTesting( |
| 4011 base::MessageLoop::current()->message_loop_proxy()); |
4010 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); | 4012 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); |
4011 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); | 4013 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); |
4012 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); | 4014 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); |
4013 | 4015 |
4014 // Uninstall the extension. | 4016 // Uninstall the extension. |
4015 service_->UninstallExtension(good_crx, false, NULL); | 4017 service_->UninstallExtension(good_crx, false, NULL); |
4016 loop_.RunUntilIdle(); | 4018 loop_.RunUntilIdle(); |
4017 | 4019 |
4018 // Check that the cookie is gone. | 4020 // Check that the cookie is gone. |
4019 cookie_monster->GetAllCookiesForURLAsync( | 4021 cookie_monster->GetAllCookiesForURLAsync( |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4115 .AddExtension(FILE_PATH_LITERAL(".localstorage")); | 4117 .AddExtension(FILE_PATH_LITERAL(".localstorage")); |
4116 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); | 4118 EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); |
4117 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); | 4119 EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); |
4118 EXPECT_TRUE(file_util::PathExists(lso_file_path)); | 4120 EXPECT_TRUE(file_util::PathExists(lso_file_path)); |
4119 | 4121 |
4120 // Create indexed db. Similarly, it is enough to only simulate this by | 4122 // Create indexed db. Similarly, it is enough to only simulate this by |
4121 // creating the directory on the disk. | 4123 // creating the directory on the disk. |
4122 IndexedDBContext* idb_context = | 4124 IndexedDBContext* idb_context = |
4123 BrowserContext::GetDefaultStoragePartition(profile_.get())-> | 4125 BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
4124 GetIndexedDBContext(); | 4126 GetIndexedDBContext(); |
| 4127 idb_context->SetTaskRunnerForTesting( |
| 4128 base::MessageLoop::current()->message_loop_proxy()); |
4125 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); | 4129 base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); |
4126 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); | 4130 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); |
4127 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); | 4131 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); |
4128 | 4132 |
4129 // Uninstall one of them, unlimited storage should still be granted | 4133 // Uninstall one of them, unlimited storage should still be granted |
4130 // to the origin. | 4134 // to the origin. |
4131 UninstallExtension(id1, false); | 4135 UninstallExtension(id1, false); |
4132 EXPECT_EQ(1u, service_->extensions()->size()); | 4136 EXPECT_EQ(1u, service_->extensions()->size()); |
4133 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> | 4137 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> |
4134 IsStorageUnlimited(origin1)); | 4138 IsStorageUnlimited(origin1)); |
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6090 new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); | 6094 new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); |
6091 AddMockExternalProvider(provider); | 6095 AddMockExternalProvider(provider); |
6092 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); | 6096 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); |
6093 | 6097 |
6094 service_->CheckForExternalUpdates(); | 6098 service_->CheckForExternalUpdates(); |
6095 loop_.RunUntilIdle(); | 6099 loop_.RunUntilIdle(); |
6096 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); | 6100 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); |
6097 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); | 6101 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); |
6098 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); | 6102 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); |
6099 } | 6103 } |
OLD | NEW |