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

Side by Side Diff: sql/test/test_helpers.cc

Issue 1133053004: sql: Remove basictypes.h includes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: shess review Created 5 years, 7 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 | « sql/test/test_helpers.h ('k') | sql/transaction.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "sql/test/test_helpers.h" 5 #include "sql/test/test_helpers.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_file.h" 10 #include "base/files/scoped_file.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 base::ScopedFILE file(base::OpenFile(db_path, "rb+")); 79 base::ScopedFILE file(base::OpenFile(db_path, "rb+"));
80 if (!file.get()) 80 if (!file.get())
81 return false; 81 return false;
82 82
83 if (0 != fseek(file.get(), 0, SEEK_SET)) 83 if (0 != fseek(file.get(), 0, SEEK_SET))
84 return false; 84 return false;
85 if (1u != fread(header, sizeof(header), 1, file.get())) 85 if (1u != fread(header, sizeof(header), 1, file.get()))
86 return false; 86 return false;
87 87
88 int64 db_size = 0; 88 int64_t db_size = 0;
89 if (!base::GetFileSize(db_path, &db_size)) 89 if (!base::GetFileSize(db_path, &db_size))
90 return false; 90 return false;
91 91
92 const unsigned page_size = ReadBigEndian(header + kPageSizeOffset, 2); 92 const unsigned page_size = ReadBigEndian(header + kPageSizeOffset, 2);
93 93
94 // One larger than the expected size. 94 // One larger than the expected size.
95 const unsigned page_count = 95 const unsigned page_count =
96 static_cast<unsigned>((db_size + page_size) / page_size); 96 static_cast<unsigned>((db_size + page_size) / page_size);
97 WriteBigEndian(page_count, header + kPageCountOffset, 4); 97 WriteBigEndian(page_count, header + kPageCountOffset, 4);
98 98
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 sql::Statement statement(db->GetUniqueStatement("PRAGMA integrity_check")); 243 sql::Statement statement(db->GetUniqueStatement("PRAGMA integrity_check"));
244 244
245 // SQLite should always return a row of data. 245 // SQLite should always return a row of data.
246 EXPECT_TRUE(statement.Step()); 246 EXPECT_TRUE(statement.Step());
247 247
248 return statement.ColumnString(0); 248 return statement.ColumnString(0);
249 } 249 }
250 250
251 } // namespace test 251 } // namespace test
252 } // namespace sql 252 } // namespace sql
OLDNEW
« no previous file with comments | « sql/test/test_helpers.h ('k') | sql/transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698