This source file includes following definitions.
- ExecuteSQLScript
#include <vector>
#include "base/file_util.h"
#include "base/format_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/history/history_unittest_base.h"
#include "sql/connection.h"
namespace history {
HistoryUnitTestBase::~HistoryUnitTestBase() {
}
void HistoryUnitTestBase::ExecuteSQLScript(const base::FilePath& sql_path,
const base::FilePath& db_path) {
std::string sql;
ASSERT_TRUE(base::ReadFileToString(sql_path, &sql));
int64 now = base::Time::Now().ToInternalValue();
std::vector<std::string> sql_time;
sql_time.push_back(base::StringPrintf("%" PRId64, now));
sql_time.push_back(base::StringPrintf("%" PRId64, now));
sql_time.push_back(base::StringPrintf("%" PRId64, now));
sql = ReplaceStringPlaceholders(sql, sql_time, NULL);
sql::Connection connection;
ASSERT_TRUE(connection.Open(db_path));
ASSERT_TRUE(connection.Execute(sql.c_str()));
}
HistoryUnitTestBase::HistoryUnitTestBase() {
}
}