Skip to content

Commit

Permalink
sql: Clean up sql::Database unit tests.
Browse files Browse the repository at this point in the history
This CL performs the following cleanups.

* SQLDatabaseTest.Rollback is deleted, because it's redundant with
  SQLTransactionTest.ExplicitRollback and
  SQLTransactionTest.NestedRollback.

* SQLDatabaseTest.RazeLock is broken into
  SQLDatabaseTest.Raze_OtherConnectionHas{Read,Write}lock.

* SQLDatabaseTest.RazeEmptyDB is renamed to EmptyDatabaseFile

* SQLDatabaseTest.RazeAndClose and RazeAndClose_Diagostics are broken
  into RazeAndClose, RazeAndClose_{DeletesData, IsOpen,
  Reopen_NoChanges, OpenTransaction, Preload_NoCrash, DoesTableExist,
  IsSQLValid, Execute, GetUniqueStatement, GetCachedStatement,
  TransactionBegin} and Close_IsSQLValid.

* RazeAndClose_Invalidates{Unique,Cached}Statement are added, based on
  the tests involving `valid_statement` in SQLDatabaseTest.Poison.

* SQLDatabaseTest.Poison is broken into sub-tests that parallel the
  RazeAndClose_* tests.

* SQLDatabaseTest.AttachDatabase{WithOpenTransaction} are cleaned up and
  ported away from sql::Database's direct transaction APIs.

* The modified tests have their SQL statements updated to follow the SQL
  style guide.

This CL is intended to give us better coverage around
Database::RazeAndClose() and Database::Poison(), and start migrating
away from Database::{Begin,Rollback,Commit}Transaction() APIs.

Bug: 1310577, 1311718
Change-Id: I1c970988851dd098c0deddb297242e37f4654340
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3558074
Reviewed-by: Austin Sullivan <asully@chromium.org>
Auto-Submit: Victor Costan <pwnall@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#987134}
  • Loading branch information
pwnall authored and Chromium LUCI CQ committed Mar 30, 2022
1 parent 9d687e7 commit e7944b4
Showing 1 changed file with 345 additions and 178 deletions.

0 comments on commit e7944b4

Please sign in to comment.