diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-07 22:24:22 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-07 22:24:22 +0000 |
commit | df5d95c4521b119234b6fcba10022437b457d55e (patch) | |
tree | 381dfcfe31729da6562ab3a8b7d50758a216e7ec | |
parent | 4c4e2a1b6146687beb17f6acecd4df14fdf74660 (diff) | |
download | chromium_src-df5d95c4521b119234b6fcba10022437b457d55e.zip chromium_src-df5d95c4521b119234b6fcba10022437b457d55e.tar.gz chromium_src-df5d95c4521b119234b6fcba10022437b457d55e.tar.bz2 |
Disable recovery test for USE_SYSTEM_SQLITE.
Detact and short-circuit rather than using an #ifdef because the test
eventually needs to be adapted to actually test this case. I'm just
not confident enough about possible edge cases to start deleting data.
BUG=299677
TBR=sky@chromium.org
Review URL: https://codereview.chromium.org/24989006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227360 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/history/thumbnail_database_unittest.cc | 10 | ||||
-rw-r--r-- | sql/recovery.cc | 10 | ||||
-rw-r--r-- | sql/recovery.h | 9 |
3 files changed, 29 insertions, 0 deletions
diff --git a/chrome/browser/history/thumbnail_database_unittest.cc b/chrome/browser/history/thumbnail_database_unittest.cc index bc1a25a..bb789a0 100644 --- a/chrome/browser/history/thumbnail_database_unittest.cc +++ b/chrome/browser/history/thumbnail_database_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/test/base/testing_profile.h" #include "sql/connection.h" +#include "sql/recovery.h" // For FullRecoverySupported(). #include "sql/statement.h" #include "sql/test/scoped_error_ignorer.h" #include "sql/test/test_helpers.h" @@ -839,6 +840,15 @@ TEST_F(ThumbnailDatabaseTest, Version7) { } TEST_F(ThumbnailDatabaseTest, Recovery) { + // This code tests the recovery module in concert with Chromium's + // custom recover virtual table. Under USE_SYSTEM_SQLITE, this is + // not available. This is detected dynamically because corrupt + // databases still need to be handled, perhaps by Raze(), and the + // recovery module is an obvious layer to abstract that to. + // TODO(shess): Handle that case for real! + if (!sql::Recovery::FullRecoverySupported()) + return; + chrome::FaviconID id1, id2; GURL page_url1("http://www.google.com"); GURL page_url2("http://news.google.com"); diff --git a/sql/recovery.cc b/sql/recovery.cc index fc67661..c750fd0 100644 --- a/sql/recovery.cc +++ b/sql/recovery.cc @@ -13,6 +13,16 @@ namespace sql { // static +bool Recovery::FullRecoverySupported() { + // TODO(shess): See comment in Init(). +#if defined(USE_SYSTEM_SQLITE) + return false; +#else + return true; +#endif +} + +// static scoped_ptr<Recovery> Recovery::Begin( Connection* connection, const base::FilePath& db_path) { diff --git a/sql/recovery.h b/sql/recovery.h index e832da6..be23e97 100644 --- a/sql/recovery.h +++ b/sql/recovery.h @@ -41,6 +41,15 @@ class SQL_EXPORT Recovery { public: ~Recovery(); + // This module is intended to be used in concert with a virtual + // table module (see third_party/sqlite/src/src/recover.c). If the + // build defines USE_SYSTEM_SQLITE, this module will not be present. + // TODO(shess): I am still debating how to handle this - perhaps it + // will just imply Unrecoverable(). This is exposed to allow tests + // to adapt to the cases, please do not rely on it in production + // code. + static bool FullRecoverySupported(); + // Begin the recovery process by opening a temporary database handle // and attach the existing database to it at "corrupt". To prevent // deadlock, all transactions on |connection| are rolled back. |