Index: webkit/dom_storage/dom_storage_area.cc |
diff --git a/webkit/dom_storage/dom_storage_area.cc b/webkit/dom_storage/dom_storage_area.cc |
index 734edffa0ef2bec4e82551477e90908bffd1ade6..3f9301a54e0ef65fd7c85f2460b866177e0f5190 100644 |
--- a/webkit/dom_storage/dom_storage_area.cc |
+++ b/webkit/dom_storage/dom_storage_area.cc |
@@ -24,7 +24,8 @@ using webkit_database::DatabaseUtil; |
namespace dom_storage { |
-static const int kCommitTimerSeconds = 1; |
+// Non-const for testing. |
+static int commit_timer_seconds = 1; |
DomStorageArea::CommitBatch::CommitBatch() |
: clear_all_first(false) { |
@@ -274,7 +275,7 @@ DomStorageArea::CommitBatch* DomStorageArea::CreateCommitBatchIfNeeded() { |
task_runner_->PostDelayedTask( |
FROM_HERE, |
base::Bind(&DomStorageArea::OnCommitTimer, this), |
- base::TimeDelta::FromSeconds(kCommitTimerSeconds)); |
+ base::TimeDelta::FromSeconds(commit_timer_seconds)); |
} |
} |
return commit_batch_.get(); |
@@ -325,7 +326,7 @@ void DomStorageArea::OnCommitComplete() { |
task_runner_->PostDelayedTask( |
FROM_HERE, |
base::Bind(&DomStorageArea::OnCommitTimer, this), |
- base::TimeDelta::FromSeconds(kCommitTimerSeconds)); |
+ base::TimeDelta::FromSeconds(commit_timer_seconds)); |
} |
} |
@@ -345,4 +346,9 @@ void DomStorageArea::ShutdownInCommitSequence() { |
session_storage_backing_ = NULL; |
} |
+// static |
+void DomStorageArea::DisableCommitDelayForTesting() { |
+ commit_timer_seconds = 0; |
+} |
+ |
} // namespace dom_storage |