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

Unified Diff: components/history/content/browser/content_history_unittest.cc

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/history.gypi ('k') | components/history/core/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/history/content/browser/content_history_unittest.cc
diff --git a/chrome/browser/history/history_unittest.cc b/components/history/content/browser/content_history_unittest.cc
similarity index 97%
rename from chrome/browser/history/history_unittest.cc
rename to components/history/content/browser/content_history_unittest.cc
index edd9ddfb30979736b16690779dbebe329f582e57..062817145f5a2424e8a039ec2079c3c647df6c00 100644
--- a/chrome/browser/history/history_unittest.cc
+++ b/components/history/content/browser/content_history_unittest.cc
@@ -42,10 +42,6 @@
#include "base/task/cancelable_task_tracker.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths.h"
-#include "components/history/content/browser/download_constants_utils.h"
-#include "components/history/content/browser/history_database_helper.h"
#include "components/history/core/browser/download_constants.h"
#include "components/history/core/browser/download_row.h"
#include "components/history/core/browser/history_backend.h"
@@ -58,12 +54,10 @@
#include "components/history/core/browser/in_memory_history_backend.h"
#include "components/history/core/browser/page_usage_data.h"
#include "components/history/core/common/thumbnail_score.h"
+#include "components/history/core/test/database_test_utils.h"
#include "components/history/core/test/history_unittest_base.h"
#include "components/history/core/test/test_history_database.h"
#include "components/history/core/test/thumbnail-inl.h"
-#include "content/public/browser/download_item.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_source.h"
#include "sql/connection.h"
#include "sql/statement.h"
#include "sync/api/attachments/attachment_id.h"
@@ -83,7 +77,6 @@
using base::Time;
using base::TimeDelta;
-using content::DownloadItem;
namespace history {
class HistoryBackendDBTest;
@@ -137,7 +130,7 @@ class HistoryBackendDBTest : public HistoryUnitTestBase {
void CreateBackendAndDatabase() {
backend_ = new HistoryBackend(new BackendDelegate(this), nullptr);
backend_->Init(std::string(), false,
- HistoryDatabaseParamsForPath(history_dir_));
+ TestHistoryDatabaseParamsForPath(history_dir_));
db_ = backend_->db_.get();
DCHECK(in_mem_backend_) << "Mem backend should have been set by "
"HistoryBackend::Init";
@@ -145,8 +138,7 @@ class HistoryBackendDBTest : public HistoryUnitTestBase {
void CreateDBVersion(int version) {
base::FilePath data_path;
- ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
- data_path = data_path.AppendASCII("History");
+ ASSERT_TRUE(GetTestDataHistoryDir(&data_path));
data_path =
data_path.AppendASCII(base::StringPrintf("history.%d.sql", version));
ASSERT_NO_FATAL_FAILURE(
@@ -155,8 +147,7 @@ class HistoryBackendDBTest : public HistoryUnitTestBase {
void CreateArchivedDB() {
base::FilePath data_path;
- ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
- data_path = data_path.AppendASCII("History");
+ ASSERT_TRUE(GetTestDataHistoryDir(&data_path));
data_path = data_path.AppendASCII("archived_history.4.sql");
ASSERT_NO_FATAL_FAILURE(ExecuteSQLScript(
data_path, history_dir_.Append(kArchivedHistoryFilename)));
@@ -204,8 +195,7 @@ class HistoryBackendDBTest : public HistoryUnitTestBase {
512,
state,
DownloadDangerType::NOT_DANGEROUS,
- ToHistoryDownloadInterruptReason(
- content::DOWNLOAD_INTERRUPT_REASON_NONE),
+ kTestDownloadInterruptReasonNone,
id,
false,
"by_ext_id",
@@ -263,8 +253,7 @@ TEST_F(HistoryBackendDBTest, ClearBrowsingData_Downloads) {
EXPECT_EQ(512, downloads[0].total_bytes);
EXPECT_EQ(DownloadState::COMPLETE, downloads[0].state);
EXPECT_EQ(DownloadDangerType::NOT_DANGEROUS, downloads[0].danger_type);
- EXPECT_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE,
- downloads[0].interrupt_reason);
+ EXPECT_EQ(kTestDownloadInterruptReasonNone, downloads[0].interrupt_reason);
EXPECT_FALSE(downloads[0].opened);
EXPECT_EQ("by_ext_id", downloads[0].by_ext_id);
EXPECT_EQ("by_ext_name", downloads[0].by_ext_name);
@@ -415,7 +404,7 @@ TEST_F(HistoryBackendDBTest, MigrateDownloadsReasonPathsAndDangerType) {
"FROM downloads ORDER BY id"));
EXPECT_TRUE(statement.Step());
EXPECT_EQ(1, statement.ColumnInt64(0));
- EXPECT_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE,
+ EXPECT_EQ(DownloadInterruptReasonToInt(kTestDownloadInterruptReasonNone),
statement.ColumnInt(1));
EXPECT_EQ("", statement.ColumnString(2));
EXPECT_EQ("", statement.ColumnString(3));
@@ -427,7 +416,7 @@ TEST_F(HistoryBackendDBTest, MigrateDownloadsReasonPathsAndDangerType) {
EXPECT_TRUE(statement.Step());
EXPECT_EQ(2, statement.ColumnInt64(0));
- EXPECT_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE,
+ EXPECT_EQ(DownloadInterruptReasonToInt(kTestDownloadInterruptReasonNone),
statement.ColumnInt(1));
EXPECT_EQ("/path/to/some/file", statement.ColumnString(2));
EXPECT_EQ("/path/to/some/file", statement.ColumnString(3));
@@ -781,8 +770,7 @@ TEST_F(HistoryBackendDBTest, DownloadNukeRecordsMissingURLs) {
512,
DownloadState::COMPLETE,
DownloadDangerType::NOT_DANGEROUS,
- ToHistoryDownloadInterruptReason(
- content::DOWNLOAD_INTERRUPT_REASON_NONE),
+ kTestDownloadInterruptReasonNone,
1,
0,
"by_ext_id",
@@ -846,7 +834,8 @@ TEST_F(HistoryBackendDBTest, ConfirmDownloadInProgressCleanup) {
EXPECT_TRUE(statement1.Step());
EXPECT_EQ(DownloadStateToInt(DownloadState::IN_PROGRESS),
statement1.ColumnInt(0));
- EXPECT_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, statement1.ColumnInt(1));
+ EXPECT_EQ(DownloadInterruptReasonToInt(kTestDownloadInterruptReasonNone),
+ statement1.ColumnInt(1));
EXPECT_FALSE(statement1.Step());
}
@@ -857,8 +846,7 @@ TEST_F(HistoryBackendDBTest, ConfirmDownloadInProgressCleanup) {
db_->QueryDownloads(&results);
ASSERT_EQ(1u, results.size());
EXPECT_EQ(DownloadState::INTERRUPTED, results[0].state);
- EXPECT_EQ(content::DOWNLOAD_INTERRUPT_REASON_CRASH,
- results[0].interrupt_reason);
+ EXPECT_EQ(kTestDownloadInterruptReasonCrash, results[0].interrupt_reason);
// Allow the update to propagate, shut down the DB, and confirm that
// the query updated the on disk database as well.
@@ -877,7 +865,7 @@ TEST_F(HistoryBackendDBTest, ConfirmDownloadInProgressCleanup) {
EXPECT_TRUE(statement1.Step());
EXPECT_EQ(DownloadStateToInt(DownloadState::INTERRUPTED),
statement1.ColumnInt(0));
- EXPECT_EQ(content::DOWNLOAD_INTERRUPT_REASON_CRASH,
+ EXPECT_EQ(DownloadInterruptReasonToInt(kTestDownloadInterruptReasonCrash),
statement1.ColumnInt(1));
EXPECT_FALSE(statement1.Step());
}
@@ -996,8 +984,8 @@ class HistoryTest : public testing::Test {
history_dir_ = temp_dir_.path().AppendASCII("HistoryTest");
ASSERT_TRUE(base::CreateDirectory(history_dir_));
history_service_.reset(new history::HistoryService);
- if (!history_service_->Init(std::string(),
- HistoryDatabaseParamsForPath(history_dir_))) {
+ if (!history_service_->Init(
+ std::string(), TestHistoryDatabaseParamsForPath(history_dir_))) {
history_service_.reset();
ADD_FAILURE();
}
« no previous file with comments | « components/history.gypi ('k') | components/history/core/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698