[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}
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 @@
 }
 #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