Index: chrome/browser/extensions/extension_service_unittest.cc |
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc |
index 007dcd39c16368dbb30f6a4d3e3116603b165c82..80d8904eae0a4049d702ddd8f3d69593eee6eb5c 100644 |
--- a/chrome/browser/extensions/extension_service_unittest.cc |
+++ b/chrome/browser/extensions/extension_service_unittest.cc |
@@ -3753,6 +3753,9 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { |
GURL ext_url(extension->url()); |
string16 origin_id = |
webkit_database::DatabaseUtil::GetOriginIdentifier(ext_url); |
+ // For extensions, the extension's base URL is always the site. |
+ content::StoragePartition* partition = |
+ BrowserContext::GetStoragePartition(profile_.get(), ext_url); |
// Set a cookie for the extension. |
net::CookieMonster* cookie_monster = |
@@ -3776,8 +3779,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { |
// Open a database. |
webkit_database::DatabaseTracker* db_tracker = |
- BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
- GetDatabaseTracker(); |
+ partition->GetDatabaseTracker(); |
string16 db_name = UTF8ToUTF16("db"); |
string16 description = UTF8ToUTF16("db_description"); |
int64 size; |
@@ -3791,7 +3793,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { |
// Create local storage. We only simulate this by creating the backing files. |
// Note: This test depends on details of how the dom_storage library |
// stores data in the host file system. |
- FilePath lso_dir_path = profile_->GetPath().AppendASCII("Local Storage"); |
+ FilePath lso_dir_path = partition->GetPath().AppendASCII("Local Storage"); |
FilePath lso_file_path = lso_dir_path.AppendASCII( |
UTF16ToUTF8(origin_id) + ".localstorage"); |
EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); |
@@ -3800,9 +3802,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { |
// Create indexed db. Similarly, it is enough to only simulate this by |
// creating the directory on the disk. |
- IndexedDBContext* idb_context = |
- BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
- GetIndexedDBContext(); |
+ IndexedDBContext* idb_context = partition->GetIndexedDBContext(); |
FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); |
EXPECT_TRUE(file_util::CreateDirectory(idb_path)); |
EXPECT_TRUE(file_util::DirectoryExists(idb_path)); |
@@ -3852,6 +3852,9 @@ TEST_F(ExtensionServiceTest, ClearAppData) { |
IsStorageUnlimited(origin1)); |
string16 origin_id = |
webkit_database::DatabaseUtil::GetOriginIdentifier(origin1); |
+ // For extensions, the extension's base URL is always the site. |
+ content::StoragePartition* partition = |
+ BrowserContext::GetStoragePartition(profile_.get(), extension->url()); |
// Install app2 from the same origin with unlimited storage. |
extension = PackAndInstallCRX(data_dir_.AppendASCII("app2"), INSTALL_NEW); |
@@ -3866,10 +3869,12 @@ TEST_F(ExtensionServiceTest, ClearAppData) { |
EXPECT_EQ(origin1, origin2); |
EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> |
IsStorageUnlimited(origin2)); |
+ // Neither apps here have isolated storage, so they should share the same |
+ // partition. |
// Set a cookie for the extension. |
net::CookieMonster* cookie_monster = |
- profile_->GetRequestContext()->GetURLRequestContext()-> |
+ partition->GetRequestContext()->GetURLRequestContext()-> |
cookie_store()->GetCookieMonster(); |
ASSERT_TRUE(cookie_monster); |
net::CookieOptions options; |
@@ -3889,8 +3894,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { |
// Open a database. |
webkit_database::DatabaseTracker* db_tracker = |
- BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
- GetDatabaseTracker(); |
+ partition->GetDatabaseTracker(); |
string16 db_name = UTF8ToUTF16("db"); |
string16 description = UTF8ToUTF16("db_description"); |
int64 size; |
@@ -3904,7 +3908,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { |
// Create local storage. We only simulate this by creating the backing files. |
// Note: This test depends on details of how the dom_storage library |
// stores data in the host file system. |
- FilePath lso_dir_path = profile_->GetPath().AppendASCII("Local Storage"); |
+ FilePath lso_dir_path = partition->GetPath().AppendASCII("Local Storage"); |
FilePath lso_file_path = lso_dir_path.AppendASCII( |
UTF16ToUTF8(origin_id) + ".localstorage"); |
EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); |
@@ -3913,9 +3917,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { |
// Create indexed db. Similarly, it is enough to only simulate this by |
// creating the directory on the disk. |
- IndexedDBContext* idb_context = |
- BrowserContext::GetDefaultStoragePartition(profile_.get())-> |
- GetIndexedDBContext(); |
+ IndexedDBContext* idb_context = partition->GetIndexedDBContext(); |
FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); |
EXPECT_TRUE(file_util::CreateDirectory(idb_path)); |
EXPECT_TRUE(file_util::DirectoryExists(idb_path)); |