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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
5 #include "base/bind.h" | 8 #include "base/bind.h" |
6 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
7 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
8 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
9 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" |
10 #include "base/metrics/statistics_recorder.h" | 14 #include "base/metrics/statistics_recorder.h" |
11 #include "base/test/histogram_tester.h" | 15 #include "base/test/histogram_tester.h" |
12 #include "base/trace_event/process_memory_dump.h" | 16 #include "base/trace_event/process_memory_dump.h" |
13 #include "sql/connection.h" | 17 #include "sql/connection.h" |
14 #include "sql/correct_sql_test_base.h" | 18 #include "sql/correct_sql_test_base.h" |
15 #include "sql/meta_table.h" | 19 #include "sql/meta_table.h" |
16 #include "sql/statement.h" | 20 #include "sql/statement.h" |
17 #include "sql/test/error_callback_support.h" | 21 #include "sql/test/error_callback_support.h" |
18 #include "sql/test/scoped_error_ignorer.h" | 22 #include "sql/test/scoped_error_ignorer.h" |
19 #include "sql/test/test_helpers.h" | 23 #include "sql/test/test_helpers.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 private: | 208 private: |
205 mode_t old_umask_; | 209 mode_t old_umask_; |
206 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedUmaskSetter); | 210 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedUmaskSetter); |
207 }; | 211 }; |
208 #endif | 212 #endif |
209 | 213 |
210 // SQLite function to adjust mock time by |argv[0]| milliseconds. | 214 // SQLite function to adjust mock time by |argv[0]| milliseconds. |
211 void sqlite_adjust_millis(sql::test::ScopedMockTimeSource* time_mock, | 215 void sqlite_adjust_millis(sql::test::ScopedMockTimeSource* time_mock, |
212 sqlite3_context* context, | 216 sqlite3_context* context, |
213 int argc, sqlite3_value** argv) { | 217 int argc, sqlite3_value** argv) { |
214 int64 milliseconds = argc > 0 ? sqlite3_value_int64(argv[0]) : 1000; | 218 int64_t milliseconds = argc > 0 ? sqlite3_value_int64(argv[0]) : 1000; |
215 time_mock->adjust(base::TimeDelta::FromMilliseconds(milliseconds)); | 219 time_mock->adjust(base::TimeDelta::FromMilliseconds(milliseconds)); |
216 sqlite3_result_int64(context, milliseconds); | 220 sqlite3_result_int64(context, milliseconds); |
217 } | 221 } |
218 | 222 |
219 // Adjust mock time by |milliseconds| on commit. | 223 // Adjust mock time by |milliseconds| on commit. |
220 int adjust_commit_hook(sql::test::ScopedMockTimeSource* time_mock, | 224 int adjust_commit_hook(sql::test::ScopedMockTimeSource* time_mock, |
221 int64 milliseconds) { | 225 int64_t milliseconds) { |
222 time_mock->adjust(base::TimeDelta::FromMilliseconds(milliseconds)); | 226 time_mock->adjust(base::TimeDelta::FromMilliseconds(milliseconds)); |
223 return SQLITE_OK; | 227 return SQLITE_OK; |
224 } | 228 } |
225 | 229 |
226 const char kCommitTime[] = "Sqlite.CommitTime.Test"; | 230 const char kCommitTime[] = "Sqlite.CommitTime.Test"; |
227 const char kAutoCommitTime[] = "Sqlite.AutoCommitTime.Test"; | 231 const char kAutoCommitTime[] = "Sqlite.AutoCommitTime.Test"; |
228 const char kUpdateTime[] = "Sqlite.UpdateTime.Test"; | 232 const char kUpdateTime[] = "Sqlite.UpdateTime.Test"; |
229 const char kQueryTime[] = "Sqlite.QueryTime.Test"; | 233 const char kQueryTime[] = "Sqlite.QueryTime.Test"; |
230 | 234 |
231 } // namespace | 235 } // namespace |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 // With no key, map everything and create the key. | 1466 // With no key, map everything and create the key. |
1463 // TODO(shess): This really should be "maps everything after validating it", | 1467 // TODO(shess): This really should be "maps everything after validating it", |
1464 // but that is more complicated to structure. | 1468 // but that is more complicated to structure. |
1465 ASSERT_GT(db().GetAppropriateMmapSize(), kMmapAlot); | 1469 ASSERT_GT(db().GetAppropriateMmapSize(), kMmapAlot); |
1466 ASSERT_TRUE(MetaTable::GetMmapStatus(&db(), &mmap_status)); | 1470 ASSERT_TRUE(MetaTable::GetMmapStatus(&db(), &mmap_status)); |
1467 ASSERT_EQ(MetaTable::kMmapSuccess, mmap_status); | 1471 ASSERT_EQ(MetaTable::kMmapSuccess, mmap_status); |
1468 } | 1472 } |
1469 #endif | 1473 #endif |
1470 | 1474 |
1471 } // namespace sql | 1475 } // namespace sql |
OLD | NEW |