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

Unified Diff: webkit/dom_storage/dom_storage_database.h

Issue 9718029: DomStorage commit task sequencing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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/dom_storage/dom_storage_context.cc ('k') | webkit/dom_storage/dom_storage_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « webkit/dom_storage/dom_storage_context.cc ('k') | webkit/dom_storage/dom_storage_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698