OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "sql/connection.h" | 10 #include "sql/connection.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 ASSERT_TRUE(db().Execute("INSERT INTO foo (x) VALUES ('test')")); | 106 ASSERT_TRUE(db().Execute("INSERT INTO foo (x) VALUES ('test')")); |
107 | 107 |
108 sql::Statement s(db().GetUniqueStatement( | 108 sql::Statement s(db().GetUniqueStatement( |
109 "SELECT x FROM foo WHERE x MATCH 'te*'")); | 109 "SELECT x FROM foo WHERE x MATCH 'te*'")); |
110 ASSERT_TRUE(s.Step()); | 110 ASSERT_TRUE(s.Step()); |
111 EXPECT_EQ("test", s.ColumnString(0)); | 111 EXPECT_EQ("test", s.ColumnString(0)); |
112 } | 112 } |
113 #endif | 113 #endif |
114 | 114 |
| 115 #if !defined(USE_SYSTEM_SQLITE) |
| 116 // Verify that Chromium's SQLite is compiled with HAVE_USLEEP defined. With |
| 117 // HAVE_USLEEP, SQLite uses usleep() with millisecond granularity. Otherwise it |
| 118 // uses sleep() with second granularity. |
| 119 TEST_F(SQLiteFeaturesTest, UsesUsleep) { |
| 120 base::TimeTicks before = base::TimeTicks::Now(); |
| 121 sqlite3_sleep(1); |
| 122 base::TimeDelta delta = base::TimeTicks::Now() - before; |
| 123 |
| 124 // It is not impossible for this to be over 1000 if things are compiled the |
| 125 // right way. But it is very unlikely, most platforms seem to be around |
| 126 // <TBD>. |
| 127 LOG(ERROR) << "Milliseconds: " << delta.InMilliseconds(); |
| 128 EXPECT_LT(delta.InMilliseconds(), 1000); |
| 129 } |
| 130 #endif |
| 131 |
115 } // namespace | 132 } // namespace |
OLD | NEW |