summaryrefslogtreecommitdiffstats
path: root/webkit/database
diff options
context:
space:
mode:
authormarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-17 09:23:00 +0000
committermarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-17 09:23:00 +0000
commitd024044a7b26967f7db9d9b228224a98cb7c159d (patch)
treeb34e31150a8628e252e1c9f4cbcdd88197e752ca /webkit/database
parent4ace61778d6bfa9eb8a61f5a1879ba1bb278a561 (diff)
downloadchromium_src-d024044a7b26967f7db9d9b228224a98cb7c159d.zip
chromium_src-d024044a7b26967f7db9d9b228224a98cb7c159d.tar.gz
chromium_src-d024044a7b26967f7db9d9b228224a98cb7c159d.tar.bz2
Test cleanup: Using MockSpecialStoragePolicy instead of local subclasses of SpecialStoragePolicy.
BUG=NONE TEST=Existing tests pass: FileSystemDirURLRequestJobTest.*, FileSystemURLRequestJobTest.*, FileSystemContextTest.*, DatabaseTrackerTest.*, QuotaFileUtilTest.*, FileSystemPathManagerTest.*, SandboxMountPointProviderMigrationTest.* Review URL: http://codereview.chromium.org/7633016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/database')
-rw-r--r--webkit/database/database_tracker_unittest.cc41
1 files changed, 17 insertions, 24 deletions
diff --git a/webkit/database/database_tracker_unittest.cc b/webkit/database/database_tracker_unittest.cc
index cf499b9..9080933 100644
--- a/webkit/database/database_tracker_unittest.cc
+++ b/webkit/database/database_tracker_unittest.cc
@@ -15,29 +15,14 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/database/database_tracker.h"
#include "webkit/database/database_util.h"
+#include "webkit/quota/mock_special_storage_policy.h"
#include "webkit/quota/quota_manager.h"
-#include "webkit/quota/special_storage_policy.h"
namespace {
const char kOrigin1Url[] = "http://origin1";
const char kOrigin2Url[] = "http://protected_origin2";
-class TestSpecialStoragePolicy : public quota::SpecialStoragePolicy {
- public:
- virtual bool IsStorageProtected(const GURL& origin) {
- return origin == GURL(kOrigin2Url);
- }
-
- virtual bool IsStorageUnlimited(const GURL& origin) {
- return false;
- }
-
- virtual bool IsFileHandler(const std::string& extension_id) {
- return false;
- }
-};
-
class TestObserver : public webkit_database::DatabaseTracker::Observer {
public:
TestObserver() : new_notification_received_(false) {}
@@ -185,10 +170,12 @@ class DatabaseTracker_TestHelper_Test {
// Initialize the tracker database.
ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+ scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy =
+ new quota::MockSpecialStoragePolicy;
+ special_storage_policy->AddProtected(GURL(kOrigin2Url));
scoped_refptr<DatabaseTracker> tracker(
new DatabaseTracker(temp_dir.path(), incognito_mode, false,
- new TestSpecialStoragePolicy,
- NULL, NULL));
+ special_storage_policy, NULL, NULL));
// Create and open three databases.
int64 database_size = 0;
@@ -288,10 +275,12 @@ class DatabaseTracker_TestHelper_Test {
// Initialize the tracker database.
ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+ scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy =
+ new quota::MockSpecialStoragePolicy;
+ special_storage_policy->AddProtected(GURL(kOrigin2Url));
scoped_refptr<DatabaseTracker> tracker(
new DatabaseTracker(temp_dir.path(), incognito_mode, false,
- new TestSpecialStoragePolicy,
- NULL, NULL));
+ special_storage_policy, NULL, NULL));
// Add two observers.
TestObserver observer1;
@@ -535,11 +524,13 @@ class DatabaseTracker_TestHelper_Test {
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
FilePath origin1_db_dir;
{
+ scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy =
+ new quota::MockSpecialStoragePolicy;
+ special_storage_policy->AddProtected(GURL(kOrigin2Url));
scoped_refptr<DatabaseTracker> tracker(
new DatabaseTracker(
temp_dir.path(), false, true,
- new TestSpecialStoragePolicy,
- NULL,
+ special_storage_policy, NULL,
base::MessageLoopProxy::current()));
// Open three new databases.
@@ -596,10 +587,12 @@ class DatabaseTracker_TestHelper_Test {
}
// At this point, the database tracker should be gone. Create a new one.
+ scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy =
+ new quota::MockSpecialStoragePolicy;
+ special_storage_policy->AddProtected(GURL(kOrigin2Url));
scoped_refptr<DatabaseTracker> tracker(
new DatabaseTracker(temp_dir.path(), false, false,
- new TestSpecialStoragePolicy,
- NULL, NULL));
+ special_storage_policy, NULL, NULL));
// Get all data for all origins.
std::vector<OriginInfo> origins_info;