From 1f8730337a1fcc34984a7549d6c1da9dba7d3293 Mon Sep 17 00:00:00 2001 From: "dgrogan@chromium.org" Date: Fri, 2 Mar 2012 23:59:04 +0000 Subject: 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 --- .../in_process_webkit/indexed_db_browsertest.cc | 3 +- .../indexed_db_dispatcher_host.cc | 37 ++++------------------ 2 files changed, 8 insertions(+), 32 deletions(-) (limited to 'content/browser/in_process_webkit') diff --git a/content/browser/in_process_webkit/indexed_db_browsertest.cc b/content/browser/in_process_webkit/indexed_db_browsertest.cc index f4108e3..4c681e9 100644 --- a/content/browser/in_process_webkit/indexed_db_browsertest.cc +++ b/content/browser/in_process_webkit/indexed_db_browsertest.cc @@ -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")))); } diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc index 20d8bb4..38f94fa 100644 --- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -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(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])) { -- cgit v1.1