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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "chrome/browser/history/history_unittest_base.h" 11 #include "chrome/browser/history/history_unittest_base.h"
12 #include "sql/connection.h" 12 #include "sql/connection.h"
13 13
14 namespace history { 14 namespace history {
15 15
16 HistoryUnitTestBase::~HistoryUnitTestBase() { 16 HistoryUnitTestBase::~HistoryUnitTestBase() {
17 } 17 }
18 18
19 void HistoryUnitTestBase::ExecuteSQLScript(const base::FilePath& sql_path, 19 void HistoryUnitTestBase::ExecuteSQLScript(const base::FilePath& sql_path,
20 const base::FilePath& db_path) { 20 const base::FilePath& db_path) {
21 std::string sql; 21 std::string sql;
22 ASSERT_TRUE(file_util::ReadFileToString(sql_path, &sql)); 22 ASSERT_TRUE(base::ReadFileToString(sql_path, &sql));
23 23
24 // Replace the 'last_visit_time', 'visit_time', 'time_slot' values in this 24 // Replace the 'last_visit_time', 'visit_time', 'time_slot' values in this
25 // SQL with the current time. 25 // SQL with the current time.
26 int64 now = base::Time::Now().ToInternalValue(); 26 int64 now = base::Time::Now().ToInternalValue();
27 std::vector<std::string> sql_time; 27 std::vector<std::string> sql_time;
28 sql_time.push_back(base::StringPrintf("%" PRId64, now)); // last_visit_time 28 sql_time.push_back(base::StringPrintf("%" PRId64, now)); // last_visit_time
29 sql_time.push_back(base::StringPrintf("%" PRId64, now)); // visit_time 29 sql_time.push_back(base::StringPrintf("%" PRId64, now)); // visit_time
30 sql_time.push_back(base::StringPrintf("%" PRId64, now)); // time_slot 30 sql_time.push_back(base::StringPrintf("%" PRId64, now)); // time_slot
31 sql = ReplaceStringPlaceholders(sql, sql_time, NULL); 31 sql = ReplaceStringPlaceholders(sql, sql_time, NULL);
32 32
33 sql::Connection connection; 33 sql::Connection connection;
34 ASSERT_TRUE(connection.Open(db_path)); 34 ASSERT_TRUE(connection.Open(db_path));
35 ASSERT_TRUE(connection.Execute(sql.c_str())); 35 ASSERT_TRUE(connection.Execute(sql.c_str()));
36 } 36 }
37 37
38 HistoryUnitTestBase::HistoryUnitTestBase() { 38 HistoryUnitTestBase::HistoryUnitTestBase() {
39 } 39 }
40 40
41 } // namespace history 41 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/expire_history_backend_unittest.cc ('k') | chrome/browser/history/url_index_private_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698