Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 9467016: Get rid of WebKitContext. Only two out of six HTML5 related objects were in it and it was just a gl… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix bug Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_data_deleter.cc ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 3071 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 int64 size; 3082 int64 size;
3083 db_tracker->DatabaseOpened(origin_id, db_name, description, 1, &size); 3083 db_tracker->DatabaseOpened(origin_id, db_name, description, 1, &size);
3084 db_tracker->DatabaseClosed(origin_id, db_name); 3084 db_tracker->DatabaseClosed(origin_id, db_name);
3085 std::vector<webkit_database::OriginInfo> origins; 3085 std::vector<webkit_database::OriginInfo> origins;
3086 db_tracker->GetAllOriginsInfo(&origins); 3086 db_tracker->GetAllOriginsInfo(&origins);
3087 EXPECT_EQ(1U, origins.size()); 3087 EXPECT_EQ(1U, origins.size());
3088 EXPECT_EQ(origin_id, origins[0].GetOrigin()); 3088 EXPECT_EQ(origin_id, origins[0].GetOrigin());
3089 3089
3090 // Create local storage. We only simulate this by creating the backing file 3090 // Create local storage. We only simulate this by creating the backing file
3091 // since webkit is not initialized. 3091 // since webkit is not initialized.
3092 DOMStorageContext* context = DOMStorageContext::GetForBrowserContext( 3092 DOMStorageContext* context = BrowserContext::GetDOMStorageContext(
3093 profile_.get()); 3093 profile_.get());
3094 FilePath lso_path = context->GetFilePath(origin_id); 3094 FilePath lso_path = context->GetFilePath(origin_id);
3095 EXPECT_TRUE(file_util::CreateDirectory(lso_path.DirName())); 3095 EXPECT_TRUE(file_util::CreateDirectory(lso_path.DirName()));
3096 EXPECT_EQ(0, file_util::WriteFile(lso_path, NULL, 0)); 3096 EXPECT_EQ(0, file_util::WriteFile(lso_path, NULL, 0));
3097 EXPECT_TRUE(file_util::PathExists(lso_path)); 3097 EXPECT_TRUE(file_util::PathExists(lso_path));
3098 3098
3099 // Create indexed db. Similarly, it is enough to only simulate this by 3099 // Create indexed db. Similarly, it is enough to only simulate this by
3100 // creating the directory on the disk. 3100 // creating the directory on the disk.
3101 IndexedDBContext* idb_context = IndexedDBContext::GetForBrowserContext( 3101 IndexedDBContext* idb_context = BrowserContext::GetIndexedDBContext(
3102 profile_.get()); 3102 profile_.get());
3103 FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); 3103 FilePath idb_path = idb_context->GetFilePathForTesting(origin_id);
3104 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); 3104 EXPECT_TRUE(file_util::CreateDirectory(idb_path));
3105 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); 3105 EXPECT_TRUE(file_util::DirectoryExists(idb_path));
3106 3106
3107 // Uninstall the extension. 3107 // Uninstall the extension.
3108 service_->UninstallExtension(good_crx, false, NULL); 3108 service_->UninstallExtension(good_crx, false, NULL);
3109 loop_.RunAllPending(); 3109 loop_.RunAllPending();
3110 3110
3111 // Check that the cookie is gone. 3111 // Check that the cookie is gone.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 int64 size; 3192 int64 size;
3193 db_tracker->DatabaseOpened(origin_id, db_name, description, 1, &size); 3193 db_tracker->DatabaseOpened(origin_id, db_name, description, 1, &size);
3194 db_tracker->DatabaseClosed(origin_id, db_name); 3194 db_tracker->DatabaseClosed(origin_id, db_name);
3195 std::vector<webkit_database::OriginInfo> origins; 3195 std::vector<webkit_database::OriginInfo> origins;
3196 db_tracker->GetAllOriginsInfo(&origins); 3196 db_tracker->GetAllOriginsInfo(&origins);
3197 EXPECT_EQ(1U, origins.size()); 3197 EXPECT_EQ(1U, origins.size());
3198 EXPECT_EQ(origin_id, origins[0].GetOrigin()); 3198 EXPECT_EQ(origin_id, origins[0].GetOrigin());
3199 3199
3200 // Create local storage. We only simulate this by creating the backing file 3200 // Create local storage. We only simulate this by creating the backing file
3201 // since webkit is not initialized. 3201 // since webkit is not initialized.
3202 DOMStorageContext* context = DOMStorageContext::GetForBrowserContext( 3202 DOMStorageContext* context = BrowserContext::GetDOMStorageContext(
3203 profile_.get()); 3203 profile_.get());
3204 FilePath lso_path = context->GetFilePath(origin_id); 3204 FilePath lso_path = context->GetFilePath(origin_id);
3205 EXPECT_TRUE(file_util::CreateDirectory(lso_path.DirName())); 3205 EXPECT_TRUE(file_util::CreateDirectory(lso_path.DirName()));
3206 EXPECT_EQ(0, file_util::WriteFile(lso_path, NULL, 0)); 3206 EXPECT_EQ(0, file_util::WriteFile(lso_path, NULL, 0));
3207 EXPECT_TRUE(file_util::PathExists(lso_path)); 3207 EXPECT_TRUE(file_util::PathExists(lso_path));
3208 3208
3209 // Create indexed db. Similarly, it is enough to only simulate this by 3209 // Create indexed db. Similarly, it is enough to only simulate this by
3210 // creating the directory on the disk. 3210 // creating the directory on the disk.
3211 IndexedDBContext* idb_context = IndexedDBContext::GetForBrowserContext( 3211 IndexedDBContext* idb_context = BrowserContext::GetIndexedDBContext(
3212 profile_.get()); 3212 profile_.get());
3213 FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); 3213 FilePath idb_path = idb_context->GetFilePathForTesting(origin_id);
3214 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); 3214 EXPECT_TRUE(file_util::CreateDirectory(idb_path));
3215 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); 3215 EXPECT_TRUE(file_util::DirectoryExists(idb_path));
3216 3216
3217 // Uninstall one of them, unlimited storage should still be granted 3217 // Uninstall one of them, unlimited storage should still be granted
3218 // to the origin. 3218 // to the origin.
3219 UninstallExtension(id1, false); 3219 UninstallExtension(id1, false);
3220 EXPECT_EQ(1u, service_->extensions()->size()); 3220 EXPECT_EQ(1u, service_->extensions()->size());
3221 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()-> 3221 EXPECT_TRUE(profile_->GetExtensionSpecialStoragePolicy()->
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
4784 ASSERT_FALSE(AddPendingSyncInstall()); 4784 ASSERT_FALSE(AddPendingSyncInstall());
4785 4785
4786 // Wait for the external source to install. 4786 // Wait for the external source to install.
4787 WaitForCrxInstall(crx_path_, INSTALL_NEW); 4787 WaitForCrxInstall(crx_path_, INSTALL_NEW);
4788 ASSERT_TRUE(IsCrxInstalled()); 4788 ASSERT_TRUE(IsCrxInstalled());
4789 4789
4790 // Now that the extension is installed, sync request should fail 4790 // Now that the extension is installed, sync request should fail
4791 // because the extension is already installed. 4791 // because the extension is already installed.
4792 ASSERT_FALSE(AddPendingSyncInstall()); 4792 ASSERT_FALSE(AddPendingSyncInstall());
4793 } 4793 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_data_deleter.cc ('k') | chrome/test/base/testing_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698