Index: webkit/dom_storage/dom_storage_database.h |
=================================================================== |
--- webkit/dom_storage/dom_storage_database.h (revision 127736) |
+++ webkit/dom_storage/dom_storage_database.h (working copy) |
@@ -23,7 +23,7 @@ |
class DomStorageDatabase { |
public: |
explicit DomStorageDatabase(const FilePath& file_path); |
- ~DomStorageDatabase(); |
+ virtual ~DomStorageDatabase(); // virtual for unit testing |
// Reads all the key, value pairs stored in the database and returns |
// them. |result| is assumed to be empty and any duplicate keys will |
@@ -38,6 +38,10 @@ |
// will be removed and all others will be inserted/updated as appropriate. |
bool CommitChanges(bool clear_all_first, const ValuesMap& changes); |
+ protected: |
+ // Constructor that uses an in-memory sqlite database, for testing. |
+ DomStorageDatabase(); |
+ |
private: |
FRIEND_TEST_ALL_PREFIXES(DomStorageDatabaseTest, SimpleOpenAndClose); |
FRIEND_TEST_ALL_PREFIXES(DomStorageDatabaseTest, TestLazyOpenIsLazy); |
@@ -54,6 +58,7 @@ |
FRIEND_TEST_ALL_PREFIXES(DomStorageDatabaseTest, |
TestCanOpenFileThatIsNotADatabase); |
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened); |
+ FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitTasks); |
enum SchemaVersion { |
INVALID, |
@@ -91,17 +96,6 @@ |
void Close(); |
bool IsOpen() const { return db_.get() ? db_->is_open() : false; } |
-#ifdef UNIT_TEST |
- // This constructor allows us to bypass the DCHECK in the public |
- // constructor that normally verifies a valid file path was passed to |
- // back the database on disk. We want to be able to run unit tests |
- // from in-memory databases where possible, so we use an empty |
- // backing file path to signify we should open the database in memory |
- // inside LazyOpen. This constructor will allow us to bypass the |
- // DCHECK when running the unit tests. |
- DomStorageDatabase(); |
-#endif |
- |
// Initialization code shared between the two constructors of this class. |
void Init(); |