| 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> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <fstream> | 9 #include <fstream> |
| 10 | 10 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 sql::Connection& db(GetDB()); | 242 sql::Connection& db(GetDB()); |
| 243 ASSERT_TRUE(db.is_open()); | 243 ASSERT_TRUE(db.is_open()); |
| 244 { | 244 { |
| 245 sql::Transaction transaction(&db); | 245 sql::Transaction transaction(&db); |
| 246 transaction.Begin(); | 246 transaction.Begin(); |
| 247 while (!proto_file.eof()) { | 247 while (!proto_file.eof()) { |
| 248 proto_file.getline(sql_cmd_line, kCommandBufferMaxSize); | 248 proto_file.getline(sql_cmd_line, kCommandBufferMaxSize); |
| 249 if (!proto_file.eof()) { | 249 if (!proto_file.eof()) { |
| 250 // We only process lines which begin with a upper-case letter. | 250 // We only process lines which begin with a upper-case letter. |
| 251 // TODO(mrossetti): Can iswupper() be used here? | 251 if (base::IsAsciiUpper(sql_cmd_line[0])) { |
| 252 if (sql_cmd_line[0] >= 'A' && sql_cmd_line[0] <= 'Z') { | |
| 253 std::string sql_cmd(sql_cmd_line); | 252 std::string sql_cmd(sql_cmd_line); |
| 254 sql::Statement sql_stmt(db.GetUniqueStatement(sql_cmd_line)); | 253 sql::Statement sql_stmt(db.GetUniqueStatement(sql_cmd_line)); |
| 255 EXPECT_TRUE(sql_stmt.Run()); | 254 EXPECT_TRUE(sql_stmt.Run()); |
| 256 } | 255 } |
| 257 } | 256 } |
| 258 } | 257 } |
| 259 transaction.Commit(); | 258 transaction.Commit(); |
| 260 } | 259 } |
| 261 | 260 |
| 262 // Update the last_visit_time table column in the "urls" table | 261 // Update the last_visit_time table column in the "urls" table |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 ASSERT_TRUE(GetCacheFilePath(&full_file_path)); | 1309 ASSERT_TRUE(GetCacheFilePath(&full_file_path)); |
| 1311 std::vector<base::FilePath::StringType> actual_parts; | 1310 std::vector<base::FilePath::StringType> actual_parts; |
| 1312 full_file_path.GetComponents(&actual_parts); | 1311 full_file_path.GetComponents(&actual_parts); |
| 1313 ASSERT_EQ(expected_parts.size(), actual_parts.size()); | 1312 ASSERT_EQ(expected_parts.size(), actual_parts.size()); |
| 1314 size_t count = expected_parts.size(); | 1313 size_t count = expected_parts.size(); |
| 1315 for (size_t i = 0; i < count; ++i) | 1314 for (size_t i = 0; i < count; ++i) |
| 1316 EXPECT_EQ(expected_parts[i], actual_parts[i]); | 1315 EXPECT_EQ(expected_parts[i], actual_parts[i]); |
| 1317 // Must clear the history_dir_ to satisfy the dtor's DCHECK. | 1316 // Must clear the history_dir_ to satisfy the dtor's DCHECK. |
| 1318 set_history_dir(base::FilePath()); | 1317 set_history_dir(base::FilePath()); |
| 1319 } | 1318 } |
| OLD | NEW |