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

Unified Diff: webkit/database/database_tracker_unittest.cc

Issue 7633016: Test cleanup: Using MockSpecialStoragePolicy instead of local subclasses of SpecialStoragePolicy. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Keeping up to date with trunk. Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/fileapi/file_system_context_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/database/database_tracker_unittest.cc
diff --git a/webkit/database/database_tracker_unittest.cc b/webkit/database/database_tracker_unittest.cc
index cf499b9899c45d05d3f6d63f7612c343874b7ded..90809337eaacec21b376480ffbb4e2da06ad02d7 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;
« no previous file with comments | « no previous file | webkit/fileapi/file_system_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698