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

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

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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) 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 "chrome/browser/history/history_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 1201
1202 base::FilePath old_history_path; 1202 base::FilePath old_history_path;
1203 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); 1203 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path));
1204 old_history_path = old_history_path.AppendASCII("History"); 1204 old_history_path = old_history_path.AppendASCII("History");
1205 old_history_path = old_history_path.AppendASCII("HistoryNoSource"); 1205 old_history_path = old_history_path.AppendASCII("HistoryNoSource");
1206 1206
1207 // Copy history database file to current directory so that it will be deleted 1207 // Copy history database file to current directory so that it will be deleted
1208 // in Teardown. 1208 // in Teardown.
1209 base::FilePath new_history_path(getTestDir()); 1209 base::FilePath new_history_path(getTestDir());
1210 base::DeleteFile(new_history_path, true); 1210 base::DeleteFile(new_history_path, true);
1211 file_util::CreateDirectory(new_history_path); 1211 base::CreateDirectory(new_history_path);
1212 base::FilePath new_history_file = 1212 base::FilePath new_history_file =
1213 new_history_path.Append(chrome::kHistoryFilename); 1213 new_history_path.Append(chrome::kHistoryFilename);
1214 ASSERT_TRUE(base::CopyFile(old_history_path, new_history_file)); 1214 ASSERT_TRUE(base::CopyFile(old_history_path, new_history_file));
1215 1215
1216 backend_ = new HistoryBackend(new_history_path, 1216 backend_ = new HistoryBackend(new_history_path,
1217 0, 1217 0,
1218 new HistoryBackendTestDelegate(this), 1218 new HistoryBackendTestDelegate(this),
1219 &bookmark_model_); 1219 &bookmark_model_);
1220 backend_->Init(std::string(), false); 1220 backend_->Init(std::string(), false);
1221 backend_->Closing(); 1221 backend_->Closing();
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2549 base::FilePath old_history_path, old_history, old_archived; 2549 base::FilePath old_history_path, old_history, old_archived;
2550 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path)); 2550 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &old_history_path));
2551 old_history_path = old_history_path.AppendASCII("History"); 2551 old_history_path = old_history_path.AppendASCII("History");
2552 old_history = old_history_path.AppendASCII("HistoryNoDuration"); 2552 old_history = old_history_path.AppendASCII("HistoryNoDuration");
2553 old_archived = old_history_path.AppendASCII("ArchivedNoDuration"); 2553 old_archived = old_history_path.AppendASCII("ArchivedNoDuration");
2554 2554
2555 // Copy history database file to current directory so that it will be deleted 2555 // Copy history database file to current directory so that it will be deleted
2556 // in Teardown. 2556 // in Teardown.
2557 base::FilePath new_history_path(getTestDir()); 2557 base::FilePath new_history_path(getTestDir());
2558 base::DeleteFile(new_history_path, true); 2558 base::DeleteFile(new_history_path, true);
2559 file_util::CreateDirectory(new_history_path); 2559 base::CreateDirectory(new_history_path);
2560 base::FilePath new_history_file = 2560 base::FilePath new_history_file =
2561 new_history_path.Append(chrome::kHistoryFilename); 2561 new_history_path.Append(chrome::kHistoryFilename);
2562 base::FilePath new_archived_file = 2562 base::FilePath new_archived_file =
2563 new_history_path.Append(chrome::kArchivedHistoryFilename); 2563 new_history_path.Append(chrome::kArchivedHistoryFilename);
2564 ASSERT_TRUE(base::CopyFile(old_history, new_history_file)); 2564 ASSERT_TRUE(base::CopyFile(old_history, new_history_file));
2565 ASSERT_TRUE(base::CopyFile(old_archived, new_archived_file)); 2565 ASSERT_TRUE(base::CopyFile(old_archived, new_archived_file));
2566 2566
2567 backend_ = new HistoryBackend(new_history_path, 2567 backend_ = new HistoryBackend(new_history_path,
2568 0, 2568 0,
2569 new HistoryBackendTestDelegate(this), 2569 new HistoryBackendTestDelegate(this),
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 // Delete all DTS index databases. 2878 // Delete all DTS index databases.
2879 backend_->DeleteFTSIndexDatabases(); 2879 backend_->DeleteFTSIndexDatabases();
2880 EXPECT_FALSE(base::PathExists(db1)); 2880 EXPECT_FALSE(base::PathExists(db1));
2881 EXPECT_FALSE(base::PathExists(db1_wal)); 2881 EXPECT_FALSE(base::PathExists(db1_wal));
2882 EXPECT_FALSE(base::PathExists(db1_journal)); 2882 EXPECT_FALSE(base::PathExists(db1_journal));
2883 EXPECT_FALSE(base::PathExists(db2_symlink)); 2883 EXPECT_FALSE(base::PathExists(db2_symlink));
2884 EXPECT_TRUE(base::PathExists(db2_actual)); // Symlinks shouldn't be followed. 2884 EXPECT_TRUE(base::PathExists(db2_actual)); // Symlinks shouldn't be followed.
2885 } 2885 }
2886 2886
2887 } // namespace history 2887 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/first_run/first_run_internal_win.cc ('k') | chrome/browser/history/history_querying_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698