| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "chrome/common/extensions/extension_l10n_util.h" | 72 #include "chrome/common/extensions/extension_l10n_util.h" |
| 73 #include "chrome/common/extensions/extension_manifest_constants.h" | 73 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 74 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 74 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 75 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" | 75 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" |
| 76 #include "chrome/common/extensions/manifest_url_handler.h" | 76 #include "chrome/common/extensions/manifest_url_handler.h" |
| 77 #include "chrome/common/extensions/permissions/permission_set.h" | 77 #include "chrome/common/extensions/permissions/permission_set.h" |
| 78 #include "chrome/common/pref_names.h" | 78 #include "chrome/common/pref_names.h" |
| 79 #include "chrome/common/url_constants.h" | 79 #include "chrome/common/url_constants.h" |
| 80 #include "chrome/test/base/testing_profile.h" | 80 #include "chrome/test/base/testing_profile.h" |
| 81 #include "components/user_prefs/pref_registry_syncable.h" | 81 #include "components/user_prefs/pref_registry_syncable.h" |
| 82 #include "content/public/browser/cookie_store_map.h" |
| 82 #include "content/public/browser/dom_storage_context.h" | 83 #include "content/public/browser/dom_storage_context.h" |
| 83 #include "content/public/browser/gpu_data_manager.h" | 84 #include "content/public/browser/gpu_data_manager.h" |
| 84 #include "content/public/browser/indexed_db_context.h" | 85 #include "content/public/browser/indexed_db_context.h" |
| 85 #include "content/public/browser/notification_registrar.h" | 86 #include "content/public/browser/notification_registrar.h" |
| 86 #include "content/public/browser/notification_service.h" | 87 #include "content/public/browser/notification_service.h" |
| 87 #include "content/public/browser/plugin_service.h" | 88 #include "content/public/browser/plugin_service.h" |
| 88 #include "content/public/browser/render_process_host.h" | 89 #include "content/public/browser/render_process_host.h" |
| 89 #include "content/public/browser/storage_partition.h" | 90 #include "content/public/browser/storage_partition.h" |
| 90 #include "content/public/common/content_constants.h" | 91 #include "content/public/common/content_constants.h" |
| 91 #include "content/public/test/test_browser_thread.h" | 92 #include "content/public/test/test_browser_thread.h" |
| (...skipping 3991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4083 | 4084 |
| 4084 // Load a test extension. | 4085 // Load a test extension. |
| 4085 base::FilePath path = data_dir_; | 4086 base::FilePath path = data_dir_; |
| 4086 path = path.AppendASCII("good.crx"); | 4087 path = path.AppendASCII("good.crx"); |
| 4087 const Extension* extension = InstallCRX(path, INSTALL_NEW); | 4088 const Extension* extension = InstallCRX(path, INSTALL_NEW); |
| 4088 ASSERT_TRUE(extension); | 4089 ASSERT_TRUE(extension); |
| 4089 GURL ext_url(extension->url()); | 4090 GURL ext_url(extension->url()); |
| 4090 std::string origin_id = webkit_database::GetIdentifierFromOrigin(ext_url); | 4091 std::string origin_id = webkit_database::GetIdentifierFromOrigin(ext_url); |
| 4091 | 4092 |
| 4092 // Set a cookie for the extension. | 4093 // Set a cookie for the extension. |
| 4093 net::CookieMonster* cookie_monster = | 4094 net::CookieStore* cookie_store = |
| 4094 profile_->GetRequestContextForExtensions()->GetURLRequestContext()-> | 4095 BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
| 4095 cookie_store()->GetCookieMonster(); | 4096 GetCookieStoreMap().GetForScheme(ext_url.scheme()); |
| 4097 ASSERT_TRUE(cookie_store); |
| 4098 net::CookieMonster* cookie_monster = cookie_store->GetCookieMonster(); |
| 4096 ASSERT_TRUE(cookie_monster); | 4099 ASSERT_TRUE(cookie_monster); |
| 4097 net::CookieOptions options; | 4100 net::CookieOptions options; |
| 4098 cookie_monster->SetCookieWithOptionsAsync( | 4101 cookie_monster->SetCookieWithOptionsAsync( |
| 4099 ext_url, "dummy=value", options, | 4102 ext_url, "dummy=value", options, |
| 4100 base::Bind(&ExtensionCookieCallback::SetCookieCallback, | 4103 base::Bind(&ExtensionCookieCallback::SetCookieCallback, |
| 4101 base::Unretained(&callback))); | 4104 base::Unretained(&callback))); |
| 4102 loop_.RunUntilIdle(); | 4105 loop_.RunUntilIdle(); |
| 4103 EXPECT_TRUE(callback.result_); | 4106 EXPECT_TRUE(callback.result_); |
| 4104 | 4107 |
| 4105 cookie_monster->GetAllCookiesForURLAsync( | 4108 cookie_monster->GetAllCookiesForURLAsync( |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4199 APIPermission::kUnlimitedStorage)); | 4202 APIPermission::kUnlimitedStorage)); |
| 4200 EXPECT_TRUE(extension->web_extent().MatchesURL( | 4203 EXPECT_TRUE(extension->web_extent().MatchesURL( |
| 4201 extensions::AppLaunchInfo::GetFullLaunchURL(extension))); | 4204 extensions::AppLaunchInfo::GetFullLaunchURL(extension))); |
| 4202 const GURL origin2( | 4205 const GURL origin2( |
| 4203 extensions::AppLaunchInfo::GetFullLaunchURL(extension).GetOrigin()); | 4206 extensions::AppLaunchInfo::GetFullLaunchURL(extension).GetOrigin()); |
| 4204 EXPECT_EQ(origin1, origin2); | 4207 EXPECT_EQ(origin1, origin2); |
| 4205 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> | 4208 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> |
| 4206 IsStorageUnlimited(origin2)); | 4209 IsStorageUnlimited(origin2)); |
| 4207 | 4210 |
| 4208 // Set a cookie for the extension. | 4211 // Set a cookie for the extension. |
| 4212 content::StoragePartition* partition = |
| 4213 content::BrowserContext::GetDefaultStoragePartition(profile_.get()); |
| 4209 net::CookieMonster* cookie_monster = | 4214 net::CookieMonster* cookie_monster = |
| 4210 profile_->GetRequestContext()->GetURLRequestContext()-> | 4215 partition->GetCookieStoreMap().GetForScheme(origin1.scheme())-> |
| 4211 cookie_store()->GetCookieMonster(); | 4216 GetCookieMonster(); |
| 4212 ASSERT_TRUE(cookie_monster); | 4217 ASSERT_TRUE(cookie_monster); |
| 4213 net::CookieOptions options; | 4218 net::CookieOptions options; |
| 4214 cookie_monster->SetCookieWithOptionsAsync( | 4219 cookie_monster->SetCookieWithOptionsAsync( |
| 4215 origin1, "dummy=value", options, | 4220 origin1, "dummy=value", options, |
| 4216 base::Bind(&ExtensionCookieCallback::SetCookieCallback, | 4221 base::Bind(&ExtensionCookieCallback::SetCookieCallback, |
| 4217 base::Unretained(&callback))); | 4222 base::Unretained(&callback))); |
| 4218 loop_.RunUntilIdle(); | 4223 loop_.RunUntilIdle(); |
| 4219 EXPECT_TRUE(callback.result_); | 4224 EXPECT_TRUE(callback.result_); |
| 4220 | 4225 |
| 4221 cookie_monster->GetAllCookiesForURLAsync( | 4226 cookie_monster->GetAllCookiesForURLAsync( |
| (...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6332 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); | 6337 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); |
| 6333 | 6338 |
| 6334 service_->CheckForExternalUpdates(); | 6339 service_->CheckForExternalUpdates(); |
| 6335 content::WindowedNotificationObserver( | 6340 content::WindowedNotificationObserver( |
| 6336 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 6341 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 6337 content::NotificationService::AllSources()).Wait(); | 6342 content::NotificationService::AllSources()).Wait(); |
| 6338 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); | 6343 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); |
| 6339 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); | 6344 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); |
| 6340 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); | 6345 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); |
| 6341 } | 6346 } |
| OLD | NEW |