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

Side by Side Diff: chrome/browser/history/history_unittest_base.cc

Issue 7004007: iwyu: Include stringprintf.h where appropriate, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix 2. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector> 5 #include <vector>
6 6
7 #include "app/sql/connection.h" 7 #include "app/sql/connection.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/stringprintf.h"
9 #include "base/string_util.h" 10 #include "base/string_util.h"
10 #include "chrome/browser/history/history_unittest_base.h" 11 #include "chrome/browser/history/history_unittest_base.h"
11 12
12 namespace history { 13 namespace history {
13 14
14 HistoryUnitTestBase::~HistoryUnitTestBase() { 15 HistoryUnitTestBase::~HistoryUnitTestBase() {
15 } 16 }
16 17
17 void HistoryUnitTestBase::ExecuteSQLScript(const FilePath& sql_path, 18 void HistoryUnitTestBase::ExecuteSQLScript(const FilePath& sql_path,
18 const FilePath& db_path) { 19 const FilePath& db_path) {
19 std::string sql; 20 std::string sql;
20 ASSERT_TRUE(file_util::ReadFileToString(sql_path, &sql)); 21 ASSERT_TRUE(file_util::ReadFileToString(sql_path, &sql));
21 22
22 // Replace the 'last_visit_time', 'visit_time', 'time_slot' values in this 23 // Replace the 'last_visit_time', 'visit_time', 'time_slot' values in this
23 // SQL with the current time. 24 // SQL with the current time.
24 int64 now = base::Time::Now().ToInternalValue(); 25 int64 now = base::Time::Now().ToInternalValue();
25 std::vector<std::string> sql_time; 26 std::vector<std::string> sql_time;
26 sql_time.push_back(StringPrintf("%" PRId64, now)); // last_visit_time 27 sql_time.push_back(base::StringPrintf("%" PRId64, now)); // last_visit_time
27 sql_time.push_back(StringPrintf("%" PRId64, now)); // visit_time 28 sql_time.push_back(base::StringPrintf("%" PRId64, now)); // visit_time
28 sql_time.push_back(StringPrintf("%" PRId64, now)); // time_slot 29 sql_time.push_back(base::StringPrintf("%" PRId64, now)); // time_slot
29 sql = ReplaceStringPlaceholders(sql, sql_time, NULL); 30 sql = ReplaceStringPlaceholders(sql, sql_time, NULL);
30 31
31 sql::Connection connection; 32 sql::Connection connection;
32 ASSERT_TRUE(connection.Open(db_path)); 33 ASSERT_TRUE(connection.Open(db_path));
33 ASSERT_TRUE(connection.Execute(sql.c_str())); 34 ASSERT_TRUE(connection.Execute(sql.c_str()));
34 } 35 }
35 36
36 HistoryUnitTestBase::HistoryUnitTestBase() { 37 HistoryUnitTestBase::HistoryUnitTestBase() {
37 } 38 }
38 39
39 } // namespace history 40 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/diagnostics/recon_diagnostics.cc ('k') | chrome/browser/history/text_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698