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