diff options
author | cmumford@chromium.org <cmumford@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-04 00:53:57 +0000 |
---|---|---|
committer | cmumford@chromium.org <cmumford@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-04 00:53:57 +0000 |
commit | a867738b9eaad3241742acdff44ff6cfa1a016fd (patch) | |
tree | bc0dfec6d7e9c355fd7ab7db41ec703bd0672fb3 /content | |
parent | a12a2818b20af92f4382c53f62b51ad930251574 (diff) | |
download | chromium_src-a867738b9eaad3241742acdff44ff6cfa1a016fd.zip chromium_src-a867738b9eaad3241742acdff44ff6cfa1a016fd.tar.gz chromium_src-a867738b9eaad3241742acdff44ff6cfa1a016fd.tar.bz2 |
Running AbortTasks for read_write/read_only transactions.
This change also lays the foundation to modify other tests (and write new tests)
which are parameterized so that they can for both of these modes (when
applicable).
BUG=
Review URL: https://codereview.chromium.org/224443002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/indexed_db/indexed_db_transaction_unittest.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/content/browser/indexed_db/indexed_db_transaction_unittest.cc b/content/browser/indexed_db/indexed_db_transaction_unittest.cc index f9f4add..3ce9de2 100644 --- a/content/browser/indexed_db/indexed_db_transaction_unittest.cc +++ b/content/browser/indexed_db/indexed_db_transaction_unittest.cc @@ -40,6 +40,14 @@ class IndexedDBTransactionTest : public testing::Test { DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionTest); }; +class IndexedDBTransactionTestMode : public IndexedDBTransactionTest, + public testing::WithParamInterface<indexed_db::TransactionMode> { + public: + IndexedDBTransactionTestMode() {} + private: + DISALLOW_COPY_AND_ASSIGN(IndexedDBTransactionTestMode); +}; + TEST_F(IndexedDBTransactionTest, Timeout) { const int64 id = 0; const std::set<int64> scope; @@ -124,7 +132,7 @@ class AbortObserver { DISALLOW_COPY_AND_ASSIGN(AbortObserver); }; -TEST_F(IndexedDBTransactionTest, AbortTasks) { +TEST_P(IndexedDBTransactionTestMode, AbortTasks) { const int64 id = 0; const std::set<int64> scope; const bool commit_failure = false; @@ -132,7 +140,7 @@ TEST_F(IndexedDBTransactionTest, AbortTasks) { id, new MockIndexedDBDatabaseCallbacks(), scope, - indexed_db::TRANSACTION_READ_ONLY, + GetParam(), db_, new IndexedDBFakeBackingStore::FakeTransaction(commit_failure)); db_->TransactionCreated(transaction); @@ -150,8 +158,20 @@ TEST_F(IndexedDBTransactionTest, AbortTasks) { EXPECT_FALSE(observer.abort_task_called()); transaction->Commit(); EXPECT_TRUE(observer.abort_task_called()); + EXPECT_EQ(IndexedDBTransaction::FINISHED, transaction->state()); + EXPECT_FALSE(transaction->IsTimeoutTimerRunning()); } +static const indexed_db::TransactionMode kTestModes[] = { + indexed_db::TRANSACTION_READ_ONLY, + indexed_db::TRANSACTION_READ_WRITE, + indexed_db::TRANSACTION_VERSION_CHANGE +}; + +INSTANTIATE_TEST_CASE_P(IndexedDBTransactions, + IndexedDBTransactionTestMode, + ::testing::ValuesIn(kTestModes)); + } // namespace } // namespace content |