Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: sql/sqlite_features_unittest.cc

Issue 827523004: [sql] Enable HAVE_USLEEP for more platforms. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to trunk Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/sqlite/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | third_party/sqlite/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698