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

Unified Diff: webkit/database/quota_table_unittest.cc

Issue 11274003: webkit: Merge 'database' and 'quota' to 'webkit_storage' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More EXPORT for Win Created 8 years, 2 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 | « webkit/database/quota_table.cc ('k') | webkit/database/vfs_backend.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/database/quota_table_unittest.cc
diff --git a/webkit/database/quota_table_unittest.cc b/webkit/database/quota_table_unittest.cc
deleted file mode 100644
index 7d4814ac3553514c05241bf2b1290a973ce30f5c..0000000000000000000000000000000000000000
--- a/webkit/database/quota_table_unittest.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "sql/connection.h"
-#include "sql/statement.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/database/quota_table.h"
-
-namespace {
-
-class TestErrorDelegate : public sql::ErrorDelegate {
- public:
- TestErrorDelegate() {}
- virtual ~TestErrorDelegate() {}
-
- virtual int OnError(int error,
- sql::Connection* connection,
- sql::Statement* stmt) OVERRIDE {
- return error;
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestErrorDelegate);
-};
-
-} // namespace
-
-namespace webkit_database {
-
-static bool QuotaTableIsEmpty(sql::Connection* db) {
- sql::Statement statement(db->GetCachedStatement(
- SQL_FROM_HERE, "SELECT COUNT(*) FROM Quota"));
- return (statement.is_valid() && statement.Step() && !statement.ColumnInt(0));
-}
-
-TEST(QuotaTableTest, TestIt) {
- // Initialize the 'Quota' table.
- sql::Connection db;
-
- // Set an error delegate that will make all operations return false on error.
- db.set_error_delegate(new TestErrorDelegate());
-
- // Initialize the temp dir and the 'Databases' table.
- EXPECT_TRUE(db.OpenInMemory());
- QuotaTable quota_table(&db);
- EXPECT_TRUE(quota_table.Init());
-
- // The 'Quota' table should be empty.
- EXPECT_TRUE(QuotaTableIsEmpty(&db));
-
- // Set and check the quota for a new origin.
- string16 origin = ASCIIToUTF16("origin");
- EXPECT_TRUE(quota_table.SetOriginQuota(origin, 1000));
- EXPECT_EQ(1000, quota_table.GetOriginQuota(origin));
-
- // Reset and check the quota for the same origin.
- EXPECT_TRUE(quota_table.SetOriginQuota(origin, 2000));
- EXPECT_EQ(2000, quota_table.GetOriginQuota(origin));
-
- // Clear the quota for an origin
- EXPECT_TRUE(quota_table.ClearOriginQuota(origin));
- EXPECT_TRUE(quota_table.GetOriginQuota(origin) < 0);
-
- // Check that there's no quota set for unknown origins.
- EXPECT_TRUE(quota_table.GetOriginQuota(ASCIIToUTF16("unknown_origin")) < 0);
-}
-
-} // namespace webkit_database
« no previous file with comments | « webkit/database/quota_table.cc ('k') | webkit/database/vfs_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698