diff options
author | shess <shess@chromium.org> | 2015-01-21 13:52:24 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-21 21:53:06 +0000 |
commit | 156733dbbc0068b30c0c884c78a59679c755df13 (patch) | |
tree | f67a57f963771ec90a25895e081f397a4b6040f6 /sql | |
parent | 27bd482c7dd2e4b0b795e86d6ddda624a6e4abc9 (diff) | |
download | chromium_src-156733dbbc0068b30c0c884c78a59679c755df13.zip chromium_src-156733dbbc0068b30c0c884c78a59679c755df13.tar.gz chromium_src-156733dbbc0068b30c0c884c78a59679c755df13.tar.bz2 |
[sql] Enable HAVE_USLEEP for more platforms.
HAVE_USLEEP affects SQLite's sleep implementation, which is used when
SQLite waits for a lock to clear. Browser databases are generally
uncontended, but this case could happen for WebDatabase in the renderer.
BUG=none
Review URL: https://codereview.chromium.org/827523004
Cr-Commit-Position: refs/heads/master@{#312460}
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sqlite_features_unittest.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sqlite_features_unittest.cc b/sql/sqlite_features_unittest.cc index 1aff80e..987d3a1 100644 --- a/sql/sqlite_features_unittest.cc +++ b/sql/sqlite_features_unittest.cc @@ -112,4 +112,21 @@ TEST_F(SQLiteFeaturesTest, FTS3_Prefix) { } #endif +#if !defined(USE_SYSTEM_SQLITE) +// Verify that Chromium's SQLite is compiled with HAVE_USLEEP defined. With +// HAVE_USLEEP, SQLite uses usleep() with millisecond granularity. Otherwise it +// uses sleep() with second granularity. +TEST_F(SQLiteFeaturesTest, UsesUsleep) { + base::TimeTicks before = base::TimeTicks::Now(); + sqlite3_sleep(1); + base::TimeDelta delta = base::TimeTicks::Now() - before; + + // It is not impossible for this to be over 1000 if things are compiled the + // right way. But it is very unlikely, most platforms seem to be around + // <TBD>. + LOG(ERROR) << "Milliseconds: " << delta.InMilliseconds(); + EXPECT_LT(delta.InMilliseconds(), 1000); +} +#endif + } // namespace |