Commit 1f873033 authored by dgrogan@chromium.org's avatar dgrogan@chromium.org

Fix and re-enable IndexedDBBrowserTestWithLowQuota.QuotaTest

There were two problems.
1) We had started to write into profile/IndexedDB/IndexedDB/origin.leveldb/ (note the double IndexedDB).
2) We were writing into file__0.leveldb but checking for quota in __0.leveldb.  Now we always use __0.leveldb.

BUG=104748
TEST=


Review URL: http://codereview.chromium.org/9567030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124782 0039d316-1c4b-4281-b951-d872f2087c98
parent 34cbbdfd
......@@ -333,8 +333,7 @@ class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest {
};
// No longer testable with file: URL: http://crbug.com/104748
IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithLowQuota, DISABLED_QuotaTest) {
IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithLowQuota, QuotaTest) {
SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html"))));
}
......
......@@ -29,11 +29,13 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
#include "webkit/database/database_util.h"
#include "webkit/glue/webkit_glue.h"
using content::BrowserMessageFilter;
using content::BrowserThread;
using content::UserMetricsAction;
using webkit_database::DatabaseUtil;
using WebKit::WebDOMStringList;
using WebKit::WebExceptionCode;
using WebKit::WebIDBCallbacks;
......@@ -206,22 +208,10 @@ WebIDBCursor* IndexedDBDispatcherHost::GetCursorFromId(int32 cursor_id) {
void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames(
const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
FilePath base_path = indexed_db_context_->data_path();
FilePath indexed_db_path;
if (!base_path.empty()) {
indexed_db_path = base_path.Append(
IndexedDBContextImpl::kIndexedDBDirectory);
}
FilePath indexed_db_path = indexed_db_context_->data_path();
// TODO(jorlow): This doesn't support file:/// urls properly. We probably need
// to add some toString method to WebSecurityOrigin that doesn't
// return null for them. Look at
// DatabaseUtil::GetOriginFromIdentifier.
WebSecurityOrigin origin(
WebSecurityOrigin::createFromDatabaseIdentifier(params.origin));
GURL origin_url(origin.toString());
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
Context()->GetIDBFactory()->getDatabaseNames(
new IndexedDBCallbacks<WebDOMStringList>(this, params.thread_id,
......@@ -232,20 +222,11 @@ void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames(
void IndexedDBDispatcherHost::OnIDBFactoryOpen(
const IndexedDBHostMsg_FactoryOpen_Params& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
FilePath base_path = indexed_db_context_->data_path();
FilePath indexed_db_path;
if (!base_path.empty()) {
indexed_db_path = base_path.Append(
IndexedDBContextImpl::kIndexedDBDirectory);
}
FilePath indexed_db_path = indexed_db_context_->data_path();
// TODO(jorlow): This doesn't support file:/// urls properly. We probably need
// to add some toString method to WebSecurityOrigin that doesn't
// return null for them. Look at
// DatabaseUtil::GetOriginFromIdentifier.
GURL origin_url = DatabaseUtil::GetOriginFromIdentifier(params.origin);
WebSecurityOrigin origin(
WebSecurityOrigin::createFromDatabaseIdentifier(params.origin));
GURL origin_url(origin.toString());
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
......@@ -260,12 +241,7 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen(
void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase(
const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) {
FilePath base_path = indexed_db_context_->data_path();
FilePath indexed_db_path;
if (!base_path.empty()) {
indexed_db_path = base_path.Append(
IndexedDBContextImpl::kIndexedDBDirectory);
}
FilePath indexed_db_path = indexed_db_context_->data_path();
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
Context()->GetIDBFactory()->deleteDatabase(
......@@ -1208,6 +1184,7 @@ void IndexedDBDispatcherHost::
return;
// TODO(dgrogan): Tell the page the transaction aborted because of quota.
// http://crbug.com/113118
if (parent_->Context()->WouldBeOverQuota(
transaction_url_map_[transaction_id],
transaction_size_map_[transaction_id])) {
......
......@@ -144,6 +144,7 @@ quota::StorageType FileSystemTypeToQuotaStorageType(FileSystemType type) {
// TODO(kinuko): Merge these two methods (conversion methods between
// origin url <==> identifier) with the ones in the database module.
// http://crbug.com/116476
std::string GetOriginIdentifierFromURL(const GURL& url) {
WebKit::WebSecurityOrigin web_security_origin =
WebKit::WebSecurityOrigin::createFromString(UTF8ToUTF16(url.spec()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment