Commit 3a607750 authored by Josh Karlin's avatar Josh Karlin Committed by Commit Bot

[Project Code Inclusion] Remove use of blacklist

This CL swaps 'blacklist' with 'blocklist' or 'block' throughout the
directory. A followup CL will migrate the backend database.

Bug: 1097286
Change-Id: I6f62ad1dfbcbdbc1c1ce22d3c550ebb129454bd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495607Reviewed-by: default avatarJustin DeWitt <dewittj@chromium.org>
Reviewed-by: default avatarPeter Williamson <petewil@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821887}
parent a21c3826
...@@ -100,10 +100,10 @@ public class ExploreSitesBridge { ...@@ -100,10 +100,10 @@ public class ExploreSitesBridge {
} }
/** /**
* Adds a site to the blacklist when the user chooses "remove" from the long press menu. * Adds a site to the blocklist when the user chooses "remove" from the long press menu.
*/ */
public static void blacklistSite(Profile profile, String url) { public static void blockSite(Profile profile, String url) {
ExploreSitesBridgeJni.get().blacklistSite(profile, url); ExploreSitesBridgeJni.get().blockSite(profile, url);
} }
/** /**
...@@ -164,7 +164,7 @@ public class ExploreSitesBridge { ...@@ -164,7 +164,7 @@ public class ExploreSitesBridge {
void updateCatalogFromNetwork( void updateCatalogFromNetwork(
Profile profile, boolean isImmediateFetch, Callback<Boolean> callback); Profile profile, boolean isImmediateFetch, Callback<Boolean> callback);
void getSummaryImage(Profile profile, int pixelSize, Callback<Bitmap> callback); void getSummaryImage(Profile profile, int pixelSize, Callback<Bitmap> callback);
void blacklistSite(Profile profile, String url); void blockSite(Profile profile, String url);
void recordClick(Profile profile, String url, int type); void recordClick(Profile profile, String url, int type);
void getCatalog(Profile profile, int source, List<ExploreSitesCategory> result, void getCatalog(Profile profile, int source, List<ExploreSitesCategory> result,
Callback<List<ExploreSitesCategory>> callback); Callback<List<ExploreSitesCategory>> callback);
......
...@@ -139,7 +139,7 @@ public class ExploreSitesCategory { ...@@ -139,7 +139,7 @@ public class ExploreSitesCategory {
public void addSite(ExploreSitesSite site) { public void addSite(ExploreSitesSite site) {
mSites.add(site); mSites.add(site);
if (site.getModel().get(ExploreSitesSite.BLACKLISTED_KEY)) { if (site.getModel().get(ExploreSitesSite.BLOCKED_KEY)) {
mNumRemoved++; mNumRemoved++;
} }
} }
...@@ -149,7 +149,7 @@ public class ExploreSitesCategory { ...@@ -149,7 +149,7 @@ public class ExploreSitesCategory {
} }
/** /**
* Get the number of rows that could be filled completely with sites, if no site is blacklisted. * Get the number of rows that could be filled completely with sites, if no site is blocked.
* @param numColumns - number of columns wide the layout holding this category is. This * @param numColumns - number of columns wide the layout holding this category is. This
* parameter must not be zero. * parameter must not be zero.
*/ */
...@@ -164,19 +164,19 @@ public class ExploreSitesCategory { ...@@ -164,19 +164,19 @@ public class ExploreSitesCategory {
public boolean removeSite(int tileIndex) { public boolean removeSite(int tileIndex) {
if (tileIndex > mSites.size() || tileIndex < 0) return false; if (tileIndex > mSites.size() || tileIndex < 0) return false;
// Find the siteIndex for the tileIndex by skipping over blacklisted sites. // Find the siteIndex for the tileIndex by skipping over blocked sites.
int siteIndex = 0; int siteIndex = 0;
int validSiteCount = 0; int validSiteCount = 0;
while (siteIndex < mSites.size()) { while (siteIndex < mSites.size()) {
// Skipping over blacklisted sites, look for the nth unblacklisted site. // Skipping over blocked sites, look for the nth allowed site.
if (!mSites.get(siteIndex).getModel().get(ExploreSitesSite.BLACKLISTED_KEY)) { if (!mSites.get(siteIndex).getModel().get(ExploreSitesSite.BLOCKED_KEY)) {
validSiteCount++; validSiteCount++;
} }
// When we find the nth valid site, we have found the site index matching the tile. // When we find the nth valid site, we have found the site index matching the tile.
// TileIndex is 0 based, validSiteCount is 1 based, so we add 1 to the tileIndex. // TileIndex is 0 based, validSiteCount is 1 based, so we add 1 to the tileIndex.
if (tileIndex + 1 == validSiteCount if (tileIndex + 1 == validSiteCount
&& !mSites.get(siteIndex).getModel().get(ExploreSitesSite.BLACKLISTED_KEY)) { && !mSites.get(siteIndex).getModel().get(ExploreSitesSite.BLOCKED_KEY)) {
break; break;
} }
...@@ -184,7 +184,7 @@ public class ExploreSitesCategory { ...@@ -184,7 +184,7 @@ public class ExploreSitesCategory {
} }
if (siteIndex >= mSites.size()) return false; if (siteIndex >= mSites.size()) return false;
mSites.get(siteIndex).getModel().set(ExploreSitesSite.BLACKLISTED_KEY, true); mSites.get(siteIndex).getModel().set(ExploreSitesSite.BLOCKED_KEY, true);
// Reset the tile indices to account for removed tile. // Reset the tile indices to account for removed tile.
mSites.get(siteIndex).getModel().set( mSites.get(siteIndex).getModel().set(
...@@ -192,7 +192,7 @@ public class ExploreSitesCategory { ...@@ -192,7 +192,7 @@ public class ExploreSitesCategory {
for (int i = siteIndex; i < mSites.size(); ++i) { for (int i = siteIndex; i < mSites.size(); ++i) {
ExploreSitesSite site = mSites.get(i); ExploreSitesSite site = mSites.get(i);
if (!mSites.get(i).getModel().get(ExploreSitesSite.BLACKLISTED_KEY)) { if (!mSites.get(i).getModel().get(ExploreSitesSite.BLOCKED_KEY)) {
site.getModel().set(ExploreSitesSite.TILE_INDEX_KEY, tileIndex); site.getModel().set(ExploreSitesSite.TILE_INDEX_KEY, tileIndex);
tileIndex++; tileIndex++;
} }
......
...@@ -112,7 +112,7 @@ public class ExploreSitesCategoryCardView extends LinearLayout { ...@@ -112,7 +112,7 @@ public class ExploreSitesCategoryCardView extends LinearLayout {
@Override @Override
public void removeItem() { public void removeItem() {
// Update the database on the C++ side. // Update the database on the C++ side.
ExploreSitesBridge.blacklistSite(mProfile, mSiteUrl); ExploreSitesBridge.blockSite(mProfile, mSiteUrl);
// Remove from model (category). // Remove from model (category).
mCategory.removeSite(mTileIndex); mCategory.removeSite(mTileIndex);
...@@ -257,8 +257,8 @@ public class ExploreSitesCategoryCardView extends LinearLayout { ...@@ -257,8 +257,8 @@ public class ExploreSitesCategoryCardView extends LinearLayout {
for (ExploreSitesSite site : category.getSites()) { for (ExploreSitesSite site : category.getSites()) {
if (tileIndex >= tileMax) break; if (tileIndex >= tileMax) break;
final PropertyModel siteModel = site.getModel(); final PropertyModel siteModel = site.getModel();
// Skip blacklisted sites. // Skip blocked sites.
if (siteModel.get(ExploreSitesSite.BLACKLISTED_KEY)) continue; if (siteModel.get(ExploreSitesSite.BLOCKED_KEY)) continue;
ExploreSitesTileView tileView = (ExploreSitesTileView) mTileView.getChildAt(tileIndex); ExploreSitesTileView tileView = (ExploreSitesTileView) mTileView.getChildAt(tileIndex);
tileView.initialize(mIconGenerator); tileView.initialize(mIconGenerator);
...@@ -310,7 +310,7 @@ public class ExploreSitesCategoryCardView extends LinearLayout { ...@@ -310,7 +310,7 @@ public class ExploreSitesCategoryCardView extends LinearLayout {
* An incomplete row is allowed if any of the following constraints are satisfied: * An incomplete row is allowed if any of the following constraints are satisfied:
* - There are not enough sites to populate the first row. * - There are not enough sites to populate the first row.
* - There is more than one site in the last row. * - There is more than one site in the last row.
* - There is one site in the last row as a result of the user blacklisting a site. * - There is one site in the last row as a result of the user blocking a site.
* *
* @param category The category from which the number of incomplete row will be calculated. * @param category The category from which the number of incomplete row will be calculated.
*/ */
......
...@@ -24,19 +24,18 @@ public class ExploreSitesSite { ...@@ -24,19 +24,18 @@ public class ExploreSitesSite {
new PropertyModel.ReadableObjectPropertyKey<>(); new PropertyModel.ReadableObjectPropertyKey<>();
public static final PropertyModel.WritableObjectPropertyKey<Bitmap> ICON_KEY = public static final PropertyModel.WritableObjectPropertyKey<Bitmap> ICON_KEY =
new PropertyModel.WritableObjectPropertyKey<>(); new PropertyModel.WritableObjectPropertyKey<>();
static final PropertyModel.WritableBooleanPropertyKey BLACKLISTED_KEY = static final PropertyModel.WritableBooleanPropertyKey BLOCKED_KEY =
new PropertyModel.WritableBooleanPropertyKey(); new PropertyModel.WritableBooleanPropertyKey();
private PropertyModel mModel; private PropertyModel mModel;
public ExploreSitesSite(int id, String title, String url, boolean isBlacklisted) { public ExploreSitesSite(int id, String title, String url, boolean isBlocked) {
mModel = new PropertyModel mModel = new PropertyModel
.Builder(ID_KEY, TILE_INDEX_KEY, TITLE_KEY, URL_KEY, ICON_KEY, .Builder(ID_KEY, TILE_INDEX_KEY, TITLE_KEY, URL_KEY, ICON_KEY, BLOCKED_KEY)
BLACKLISTED_KEY)
.with(ID_KEY, id) .with(ID_KEY, id)
.with(TITLE_KEY, title) .with(TITLE_KEY, title)
.with(URL_KEY, url) .with(URL_KEY, url)
.with(BLACKLISTED_KEY, isBlacklisted) .with(BLOCKED_KEY, isBlocked)
.with(TILE_INDEX_KEY, DEFAULT_TILE_INDEX) .with(TILE_INDEX_KEY, DEFAULT_TILE_INDEX)
.build(); .build();
} }
...@@ -47,8 +46,8 @@ public class ExploreSitesSite { ...@@ -47,8 +46,8 @@ public class ExploreSitesSite {
@CalledByNative @CalledByNative
private static void createSiteInCategory(int siteId, String title, String url, private static void createSiteInCategory(int siteId, String title, String url,
boolean isBlacklisted, ExploreSitesCategory category) { boolean isBlocked, ExploreSitesCategory category) {
ExploreSitesSite site = new ExploreSitesSite(siteId, title, url, isBlacklisted); ExploreSitesSite site = new ExploreSitesSite(siteId, title, url, isBlocked);
category.addSite(site); category.addSite(site);
} }
} }
...@@ -44,8 +44,8 @@ public class ExploreSitesCategoryUnitTest { ...@@ -44,8 +44,8 @@ public class ExploreSitesCategoryUnitTest {
assertEquals(siteId, category.getSites().get(0).getModel().get(ExploreSitesSite.ID_KEY)); assertEquals(siteId, category.getSites().get(0).getModel().get(ExploreSitesSite.ID_KEY));
assertEquals(title, category.getSites().get(0).getModel().get(ExploreSitesSite.TITLE_KEY)); assertEquals(title, category.getSites().get(0).getModel().get(ExploreSitesSite.TITLE_KEY));
assertEquals(url, category.getSites().get(0).getModel().get(ExploreSitesSite.URL_KEY)); assertEquals(url, category.getSites().get(0).getModel().get(ExploreSitesSite.URL_KEY));
assertTrue(category.getSites().get(0).getModel().get(ExploreSitesSite.BLACKLISTED_KEY)); assertTrue(category.getSites().get(0).getModel().get(ExploreSitesSite.BLOCKED_KEY));
assertFalse(category.getSites().get(1).getModel().get(ExploreSitesSite.BLACKLISTED_KEY)); assertFalse(category.getSites().get(1).getModel().get(ExploreSitesSite.BLOCKED_KEY));
} }
@Test @Test
...@@ -82,8 +82,8 @@ public class ExploreSitesCategoryUnitTest { ...@@ -82,8 +82,8 @@ public class ExploreSitesCategoryUnitTest {
assertEquals(4, category.getSites().size()); assertEquals(4, category.getSites().size());
assertEquals(2, category.getNumDisplayed()); assertEquals(2, category.getNumDisplayed());
assertTrue(category.getSites().get(1).getModel().get(ExploreSitesSite.BLACKLISTED_KEY)); assertTrue(category.getSites().get(1).getModel().get(ExploreSitesSite.BLOCKED_KEY));
assertTrue(category.getSites().get(2).getModel().get(ExploreSitesSite.BLACKLISTED_KEY)); assertTrue(category.getSites().get(2).getModel().get(ExploreSitesSite.BLOCKED_KEY));
// The fourth site should now be at tile index '1' (the second tile). // The fourth site should now be at tile index '1' (the second tile).
assertEquals(1, category.getSites().get(3).getModel().get(ExploreSitesSite.TILE_INDEX_KEY)); assertEquals(1, category.getSites().get(3).getModel().get(ExploreSitesSite.TILE_INDEX_KEY));
} }
......
...@@ -2548,8 +2548,8 @@ static_library("browser") { ...@@ -2548,8 +2548,8 @@ static_library("browser") {
"android/document/document_web_contents_delegate.h", "android/document/document_web_contents_delegate.h",
"android/dom_distiller/distiller_ui_handle_android.cc", "android/dom_distiller/distiller_ui_handle_android.cc",
"android/dom_distiller/distiller_ui_handle_android.h", "android/dom_distiller/distiller_ui_handle_android.h",
"android/explore_sites/blacklist_site_task.cc", "android/explore_sites/block_site_task.cc",
"android/explore_sites/blacklist_site_task.h", "android/explore_sites/block_site_task.h",
"android/explore_sites/catalog.cc", "android/explore_sites/catalog.cc",
"android/explore_sites/catalog.h", "android/explore_sites/catalog.h",
"android/explore_sites/clear_activities_task.cc", "android/explore_sites/clear_activities_task.cc",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/android/explore_sites/blacklist_site_task.h" #include "chrome/browser/android/explore_sites/block_site_task.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
namespace explore_sites { namespace explore_sites {
namespace { namespace {
static const char kBlacklistSiteSql[] = R"(INSERT INTO site_blacklist static const char kBlockSiteSql[] = R"(INSERT INTO site_blacklist
(url, date_removed) (url, date_removed)
VALUES VALUES
(?, ?);)"; (?, ?);)";
...@@ -25,7 +25,7 @@ static const char kClearSiteFromActivitySql[] = ...@@ -25,7 +25,7 @@ static const char kClearSiteFromActivitySql[] =
"DELETE FROM activity WHERE url = ?;"; "DELETE FROM activity WHERE url = ?;";
} // namespace } // namespace
bool BlacklistSiteTaskSync(std::string url, sql::Database* db) { bool BlockSiteTaskSync(std::string url, sql::Database* db) {
if (!db || url.empty()) if (!db || url.empty())
return false; return false;
...@@ -42,13 +42,13 @@ bool BlacklistSiteTaskSync(std::string url, sql::Database* db) { ...@@ -42,13 +42,13 @@ bool BlacklistSiteTaskSync(std::string url, sql::Database* db) {
time_t unix_time = time_now.ToTimeT(); time_t unix_time = time_now.ToTimeT();
// Then insert the URL. // Then insert the URL.
sql::Statement blacklist_statement( sql::Statement block_statement(
db->GetCachedStatement(SQL_FROM_HERE, kBlacklistSiteSql)); db->GetCachedStatement(SQL_FROM_HERE, kBlockSiteSql));
int col = 0; int col = 0;
blacklist_statement.BindString(col++, url); block_statement.BindString(col++, url);
blacklist_statement.BindInt64(col++, unix_time); block_statement.BindInt64(col++, unix_time);
blacklist_statement.Run(); block_statement.Run();
// Then clear all matching activity. // Then clear all matching activity.
sql::Statement clear_activity_statement( sql::Statement clear_activity_statement(
...@@ -60,23 +60,23 @@ bool BlacklistSiteTaskSync(std::string url, sql::Database* db) { ...@@ -60,23 +60,23 @@ bool BlacklistSiteTaskSync(std::string url, sql::Database* db) {
return transaction.Commit(); return transaction.Commit();
} }
BlacklistSiteTask::BlacklistSiteTask(ExploreSitesStore* store, std::string url) BlockSiteTask::BlockSiteTask(ExploreSitesStore* store, std::string url)
: store_(store), url_(url) {} : store_(store), url_(url) {}
BlacklistSiteTask::~BlacklistSiteTask() = default; BlockSiteTask::~BlockSiteTask() = default;
void BlacklistSiteTask::Run() { void BlockSiteTask::Run() {
store_->Execute(base::BindOnce(&BlacklistSiteTaskSync, url_), store_->Execute(base::BindOnce(&BlockSiteTaskSync, url_),
base::BindOnce(&BlacklistSiteTask::FinishedExecuting, base::BindOnce(&BlockSiteTask::FinishedExecuting,
weak_ptr_factory_.GetWeakPtr()), weak_ptr_factory_.GetWeakPtr()),
false); false);
} }
void BlacklistSiteTask::FinishedExecuting(bool result) { void BlockSiteTask::FinishedExecuting(bool result) {
complete_ = true; complete_ = true;
result_ = result; result_ = result;
TaskComplete(); TaskComplete();
DVLOG(1) << "Finished adding a site to the blacklist, result: " << result; DVLOG(1) << "Finished adding a site to the blocklist, result: " << result;
} }
} // namespace explore_sites } // namespace explore_sites
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_ANDROID_EXPLORE_SITES_BLACKLIST_SITE_TASK_H_ #ifndef CHROME_BROWSER_ANDROID_EXPLORE_SITES_BLOCK_SITE_TASK_H_
#define CHROME_BROWSER_ANDROID_EXPLORE_SITES_BLACKLIST_SITE_TASK_H_ #define CHROME_BROWSER_ANDROID_EXPLORE_SITES_BLOCK_SITE_TASK_H_
#include "chrome/browser/android/explore_sites/catalog.pb.h" #include "chrome/browser/android/explore_sites/catalog.pb.h"
#include "chrome/browser/android/explore_sites/explore_sites_store.h" #include "chrome/browser/android/explore_sites/explore_sites_store.h"
...@@ -14,12 +14,12 @@ using offline_pages::Task; ...@@ -14,12 +14,12 @@ using offline_pages::Task;
namespace explore_sites { namespace explore_sites {
// Takes a URL that the user has asked us to remove, and adds it to a blacklist // Takes a URL that the user has asked us to remove, and adds it to a blocklist
// of sites we will stop showing in Explore on Sites. // of sites we will stop showing in Explore on Sites.
class BlacklistSiteTask : public Task { class BlockSiteTask : public Task {
public: public:
BlacklistSiteTask(ExploreSitesStore* store, std::string url); BlockSiteTask(ExploreSitesStore* store, std::string url);
~BlacklistSiteTask() override; ~BlockSiteTask() override;
bool complete() const { return complete_; } bool complete() const { return complete_; }
bool result() const { return result_; } bool result() const { return result_; }
...@@ -37,9 +37,9 @@ class BlacklistSiteTask : public Task { ...@@ -37,9 +37,9 @@ class BlacklistSiteTask : public Task {
bool result_ = false; bool result_ = false;
BooleanCallback callback_; BooleanCallback callback_;
base::WeakPtrFactory<BlacklistSiteTask> weak_ptr_factory_{this}; base::WeakPtrFactory<BlockSiteTask> weak_ptr_factory_{this};
}; };
} // namespace explore_sites } // namespace explore_sites
#endif // CHROME_BROWSER_ANDROID_EXPLORE_SITES_BLACKLIST_SITE_TASK_H_ #endif // CHROME_BROWSER_ANDROID_EXPLORE_SITES_BLOCK_SITE_TASK_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/android/explore_sites/blacklist_site_task.h" #include "chrome/browser/android/explore_sites/block_site_task.h"
#include <memory> #include <memory>
...@@ -24,10 +24,10 @@ using InitializationStatus = ExploreSitesStore::InitializationStatus; ...@@ -24,10 +24,10 @@ using InitializationStatus = ExploreSitesStore::InitializationStatus;
const char kGoogleUrl[] = "https://www.google.com"; const char kGoogleUrl[] = "https://www.google.com";
class ExploreSitesBlacklistSiteTest : public TaskTestBase { class ExploreSitesBlockSiteTest : public TaskTestBase {
public: public:
ExploreSitesBlacklistSiteTest() = default; ExploreSitesBlockSiteTest() = default;
~ExploreSitesBlacklistSiteTest() override = default; ~ExploreSitesBlockSiteTest() override = default;
void SetUp() override { void SetUp() override {
store_ = std::make_unique<ExploreSitesStore>(task_runner()); store_ = std::make_unique<ExploreSitesStore>(task_runner());
...@@ -44,7 +44,7 @@ class ExploreSitesBlacklistSiteTest : public TaskTestBase { ...@@ -44,7 +44,7 @@ class ExploreSitesBlacklistSiteTest : public TaskTestBase {
RunUntilIdle(); RunUntilIdle();
} }
void OnAddToBlacklisTaskDone(bool success) { void OnAddToBlocklisTaskDone(bool success) {
success_ = success; success_ = success;
callback_called_ = true; callback_called_ = true;
} }
...@@ -60,10 +60,10 @@ class ExploreSitesBlacklistSiteTest : public TaskTestBase { ...@@ -60,10 +60,10 @@ class ExploreSitesBlacklistSiteTest : public TaskTestBase {
bool success_; bool success_;
bool callback_called_; bool callback_called_;
DISALLOW_COPY_AND_ASSIGN(ExploreSitesBlacklistSiteTest); DISALLOW_COPY_AND_ASSIGN(ExploreSitesBlockSiteTest);
}; };
void ExploreSitesBlacklistSiteTest::PopulateActivity() { void ExploreSitesBlockSiteTest::PopulateActivity() {
ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) { ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) {
sql::Statement insert_activity(db->GetUniqueStatement(R"( sql::Statement insert_activity(db->GetUniqueStatement(R"(
INSERT INTO activity INSERT INTO activity
...@@ -76,10 +76,10 @@ VALUES ...@@ -76,10 +76,10 @@ VALUES
})); }));
} }
TEST_F(ExploreSitesBlacklistSiteTest, StoreFailure) { TEST_F(ExploreSitesBlockSiteTest, StoreFailure) {
store()->SetInitializationStatusForTesting(InitializationStatus::kFailure, store()->SetInitializationStatusForTesting(InitializationStatus::kFailure,
false); false);
BlacklistSiteTask task(store(), kGoogleUrl); BlockSiteTask task(store(), kGoogleUrl);
RunTask(&task); RunTask(&task);
// A database failure should be completed but return with an error. // A database failure should be completed but return with an error.
...@@ -87,16 +87,16 @@ TEST_F(ExploreSitesBlacklistSiteTest, StoreFailure) { ...@@ -87,16 +87,16 @@ TEST_F(ExploreSitesBlacklistSiteTest, StoreFailure) {
EXPECT_FALSE(task.result()); EXPECT_FALSE(task.result());
} }
TEST_F(ExploreSitesBlacklistSiteTest, EmptyUrlTask) { TEST_F(ExploreSitesBlockSiteTest, EmptyUrlTask) {
PopulateActivity(); PopulateActivity();
BlacklistSiteTask task(store(), ""); BlockSiteTask task(store(), "");
RunTask(&task); RunTask(&task);
// The task should be completed but return with an error. // The task should be completed but return with an error.
EXPECT_TRUE(task.complete()); EXPECT_TRUE(task.complete());
EXPECT_FALSE(task.result()); EXPECT_FALSE(task.result());
// Check that DB's site_blacklist table is empty // Check that DB's site_blocklist table is empty
// and that activity table is not modified. // and that activity table is not modified.
ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) { ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) {
sql::Statement cat_count_s( sql::Statement cat_count_s(
...@@ -113,16 +113,16 @@ TEST_F(ExploreSitesBlacklistSiteTest, EmptyUrlTask) { ...@@ -113,16 +113,16 @@ TEST_F(ExploreSitesBlacklistSiteTest, EmptyUrlTask) {
})); }));
} }
TEST_F(ExploreSitesBlacklistSiteTest, ValidUrlTask) { TEST_F(ExploreSitesBlockSiteTest, ValidUrlTask) {
PopulateActivity(); PopulateActivity();
BlacklistSiteTask task(store(), kGoogleUrl); BlockSiteTask task(store(), kGoogleUrl);
RunTask(&task); RunTask(&task);
// Task should complete successfully // Task should complete successfully
EXPECT_TRUE(task.complete()); EXPECT_TRUE(task.complete());
EXPECT_TRUE(task.result()); EXPECT_TRUE(task.result());
// Check that DB's site_blacklist table contains kGoogleUrl and that // Check that DB's site_blocklist table contains kGoogleUrl and that
// kGoogleUrl-related activity is removed from the activity table. // kGoogleUrl-related activity is removed from the activity table.
ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) { ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) {
sql::Statement cat_count_s( sql::Statement cat_count_s(
......
...@@ -14,7 +14,7 @@ using offline_pages::Task; ...@@ -14,7 +14,7 @@ using offline_pages::Task;
namespace explore_sites { namespace explore_sites {
// Takes a URL that the user has asked us to remove, and adds it to a blacklist // Takes a URL that the user has asked us to remove, and adds it to a blocklist
// of sites we will stop showing in Explore on Sites. // of sites we will stop showing in Explore on Sites.
class ClearActivitiesTask : public Task { class ClearActivitiesTask : public Task {
public: public:
......
...@@ -14,7 +14,7 @@ using offline_pages::Task; ...@@ -14,7 +14,7 @@ using offline_pages::Task;
namespace explore_sites { namespace explore_sites {
// Takes a URL that the user has asked us to remove, and adds it to a blacklist // Takes a URL that the user has asked us to remove, and adds it to a blocklist
// of sites we will stop showing in Explore on Sites. // of sites we will stop showing in Explore on Sites.
class ClearCatalogTask : public Task { class ClearCatalogTask : public Task {
public: public:
......
...@@ -98,7 +98,7 @@ VALUES ...@@ -98,7 +98,7 @@ VALUES
std::pair<int, int> GetCatalogSizes() { std::pair<int, int> GetCatalogSizes() {
int site_count = -1; int site_count = -1;
int category_count = -1; int category_count = -1;
// Check that DB's site_blacklist table is empty. // Check that DB's blocklist table is empty.
ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) { ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) {
sql::Statement site_count_s( sql::Statement site_count_s(
db->GetUniqueStatement("SELECT COUNT(*) FROM sites")); db->GetUniqueStatement("SELECT COUNT(*) FROM sites"));
......
...@@ -62,7 +62,7 @@ void CatalogReady(ScopedJavaGlobalRef<jobject>(j_result_obj), ...@@ -62,7 +62,7 @@ void CatalogReady(ScopedJavaGlobalRef<jobject>(j_result_obj),
for (auto& site : category.sites) { for (auto& site : category.sites) {
Java_ExploreSitesSite_createSiteInCategory( Java_ExploreSitesSite_createSiteInCategory(
env, site.site_id, ConvertUTF8ToJavaString(env, site.title), env, site.site_id, ConvertUTF8ToJavaString(env, site.title),
ConvertUTF8ToJavaString(env, site.url.spec()), site.is_blacklisted, ConvertUTF8ToJavaString(env, site.url.spec()), site.is_blocked,
j_category); j_category);
} }
} }
...@@ -259,8 +259,7 @@ void JNI_ExploreSitesBridge_UpdateCatalogFromNetwork( ...@@ -259,8 +259,7 @@ void JNI_ExploreSitesBridge_UpdateCatalogFromNetwork(
ScopedJavaGlobalRef<jobject>(j_callback_obj))); ScopedJavaGlobalRef<jobject>(j_callback_obj)));
} }
void JNI_ExploreSitesBridge_BlacklistSite( void JNI_ExploreSitesBridge_BlockSite(JNIEnv* env,
JNIEnv* env,
const JavaParamRef<jobject>& j_profile, const JavaParamRef<jobject>& j_profile,
const JavaParamRef<jstring>& j_url) { const JavaParamRef<jstring>& j_url) {
Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
...@@ -272,7 +271,7 @@ void JNI_ExploreSitesBridge_BlacklistSite( ...@@ -272,7 +271,7 @@ void JNI_ExploreSitesBridge_BlacklistSite(
return; return;
} }
service->BlacklistSite(url); service->BlockSite(url);
} }
void JNI_ExploreSitesBridge_RecordClick(JNIEnv* env, void JNI_ExploreSitesBridge_RecordClick(JNIEnv* env,
......
...@@ -71,13 +71,13 @@ bool CreateActivityTable(sql::Database* db) { ...@@ -71,13 +71,13 @@ bool CreateActivityTable(sql::Database* db) {
return db->Execute(kActivityTableCreationSql); return db->Execute(kActivityTableCreationSql);
} }
static const char kSiteBlacklistTableCreationSql[] = static const char kSiteBlocklistTableCreationSql[] =
"CREATE TABLE IF NOT EXISTS site_blacklist (" "CREATE TABLE IF NOT EXISTS site_blacklist ("
"url TEXT NOT NULL UNIQUE, " "url TEXT NOT NULL UNIQUE, "
"date_removed INTEGER NOT NULL);"; // stored as unix timestamp "date_removed INTEGER NOT NULL);"; // stored as unix timestamp
bool CreateSiteBlacklistTable(sql::Database* db) { bool CreateSiteBlocklistTable(sql::Database* db) {
return db->Execute(kSiteBlacklistTableCreationSql); return db->Execute(kSiteBlocklistTableCreationSql);
} }
bool CreateLatestSchema(sql::Database* db) { bool CreateLatestSchema(sql::Database* db) {
...@@ -86,7 +86,7 @@ bool CreateLatestSchema(sql::Database* db) { ...@@ -86,7 +86,7 @@ bool CreateLatestSchema(sql::Database* db) {
return false; return false;
if (!CreateCategoriesTable(db) || !CreateSitesTable(db) || if (!CreateCategoriesTable(db) || !CreateSitesTable(db) ||
!CreateSiteBlacklistTable(db) || !CreateActivityTable(db)) { !CreateSiteBlocklistTable(db) || !CreateActivityTable(db)) {
return false; return false;
} }
......
...@@ -41,8 +41,8 @@ class ExploreSitesService : public KeyedService { ...@@ -41,8 +41,8 @@ class ExploreSitesService : public KeyedService {
// Record the click on a site and category referenced by its type. // Record the click on a site and category referenced by its type.
virtual void RecordClick(const std::string& url, int category_type) = 0; virtual void RecordClick(const std::string& url, int category_type) = 0;
// Add the url to the blacklist. // Add the url to the blocklist.
virtual void BlacklistSite(const std::string& url) = 0; virtual void BlockSite(const std::string& url) = 0;
// Remove the activity history from the specified time range. // Remove the activity history from the specified time range.
virtual void ClearActivities(base::Time begin, virtual void ClearActivities(base::Time begin,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "chrome/browser/android/explore_sites/blacklist_site_task.h" #include "chrome/browser/android/explore_sites/block_site_task.h"
#include "chrome/browser/android/explore_sites/catalog.pb.h" #include "chrome/browser/android/explore_sites/catalog.pb.h"
#include "chrome/browser/android/explore_sites/clear_activities_task.h" #include "chrome/browser/android/explore_sites/clear_activities_task.h"
#include "chrome/browser/android/explore_sites/clear_catalog_task.h" #include "chrome/browser/android/explore_sites/clear_catalog_task.h"
...@@ -136,10 +136,10 @@ void ExploreSitesServiceImpl::RecordClick(const std::string& url, ...@@ -136,10 +136,10 @@ void ExploreSitesServiceImpl::RecordClick(const std::string& url,
explore_sites_store_.get(), url, category_type)); explore_sites_store_.get(), url, category_type));
} }
void ExploreSitesServiceImpl::BlacklistSite(const std::string& url) { void ExploreSitesServiceImpl::BlockSite(const std::string& url) {
// Add the url to the blacklist table in the database. // Add the url to the blocklist table in the database.
task_queue_.AddTask( task_queue_.AddTask(
std::make_unique<BlacklistSiteTask>(explore_sites_store_.get(), url)); std::make_unique<BlockSiteTask>(explore_sites_store_.get(), url));
// TODO(https://crbug.com/893845): Remove cached category icon if affected. // TODO(https://crbug.com/893845): Remove cached category icon if affected.
} }
...@@ -245,7 +245,7 @@ std::unique_ptr<Catalog> ValidateCatalog(std::unique_ptr<Catalog> catalog) { ...@@ -245,7 +245,7 @@ std::unique_ptr<Catalog> ValidateCatalog(std::unique_ptr<Catalog> catalog) {
Site* new_site = new_category->add_sites(); Site* new_site = new_category->add_sites();
new_site->Swap(&site); new_site->Swap(&site);
// We want to use a canonicalized URL in the database so that blacklisting // We want to use a canonicalized URL in the database so that blocking
// will always work. Typically this will cause a trailing slash to be // will always work. Typically this will cause a trailing slash to be
// added if it's missing. // added if it's missing.
new_site->set_site_url(url.spec()); new_site->set_site_url(url.spec());
......
...@@ -49,7 +49,7 @@ class ExploreSitesServiceImpl : public ExploreSitesService, ...@@ -49,7 +49,7 @@ class ExploreSitesServiceImpl : public ExploreSitesService,
const std::string& accept_languages, const std::string& accept_languages,
BooleanCallback callback) override; BooleanCallback callback) override;
void RecordClick(const std::string& url, int category_type) override; void RecordClick(const std::string& url, int category_type) override;
void BlacklistSite(const std::string& url) override; void BlockSite(const std::string& url) override;
void ClearActivities(base::Time begin, void ClearActivities(base::Time begin,
base::Time end, base::Time end,
base::OnceClosure callback) override; base::OnceClosure callback) override;
......
...@@ -574,7 +574,7 @@ TEST_F(ExploreSitesServiceImplTest, UnparseableCatalogHistograms) { ...@@ -574,7 +574,7 @@ TEST_F(ExploreSitesServiceImplTest, UnparseableCatalogHistograms) {
ExploreSitesCatalogError::kParseFailure, 1); ExploreSitesCatalogError::kParseFailure, 1);
} }
TEST_F(ExploreSitesServiceImplTest, BlacklistNonCanonicalUrls) { TEST_F(ExploreSitesServiceImplTest, BlockNonCanonicalUrls) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(chrome::android::kExploreSites); scoped_feature_list.InitAndEnableFeature(chrome::android::kExploreSites);
...@@ -597,7 +597,7 @@ TEST_F(ExploreSitesServiceImplTest, BlacklistNonCanonicalUrls) { ...@@ -597,7 +597,7 @@ TEST_F(ExploreSitesServiceImplTest, BlacklistNonCanonicalUrls) {
// This will fail if canonicalization does not work correctly because // This will fail if canonicalization does not work correctly because
// kSite1Url is the canonicalized version of the URL inserted in to the // kSite1Url is the canonicalized version of the URL inserted in to the
// database. // database.
service()->BlacklistSite(kSite1Url); service()->BlockSite(kSite1Url);
PumpLoop(); PumpLoop();
service()->GetCatalog(base::BindOnce( service()->GetCatalog(base::BindOnce(
...@@ -605,8 +605,8 @@ TEST_F(ExploreSitesServiceImplTest, BlacklistNonCanonicalUrls) { ...@@ -605,8 +605,8 @@ TEST_F(ExploreSitesServiceImplTest, BlacklistNonCanonicalUrls) {
PumpLoop(); PumpLoop();
EXPECT_EQ(2U, database_categories()->at(0).sites.size()); EXPECT_EQ(2U, database_categories()->at(0).sites.size());
EXPECT_TRUE(database_categories()->at(0).sites.at(0).is_blacklisted); EXPECT_TRUE(database_categories()->at(0).sites.at(0).is_blocked);
EXPECT_FALSE(database_categories()->at(0).sites.at(1).is_blacklisted); EXPECT_FALSE(database_categories()->at(0).sites.at(1).is_blocked);
} }
TEST_F(ExploreSitesServiceImplTest, CountryCodeDefault) { TEST_F(ExploreSitesServiceImplTest, CountryCodeDefault) {
......
...@@ -10,12 +10,12 @@ ExploreSitesSite::ExploreSitesSite(int site_id, ...@@ -10,12 +10,12 @@ ExploreSitesSite::ExploreSitesSite(int site_id,
int category_id, int category_id,
GURL url, GURL url,
std::string title, std::string title,
bool is_blacklisted) bool is_blocked)
: site_id(site_id), : site_id(site_id),
category_id(category_id), category_id(category_id),
url(url), url(url),
title(title), title(title),
is_blacklisted(is_blacklisted) {} is_blocked(is_blocked) {}
ExploreSitesSite::ExploreSitesSite(ExploreSitesSite&& other) = default; ExploreSitesSite::ExploreSitesSite(ExploreSitesSite&& other) = default;
......
...@@ -26,7 +26,7 @@ struct ExploreSitesSite { ...@@ -26,7 +26,7 @@ struct ExploreSitesSite {
int category_id, int category_id,
GURL url, GURL url,
std::string title, std::string title,
bool is_blacklisted); bool is_blocked);
ExploreSitesSite(ExploreSitesSite&& other); ExploreSitesSite(ExploreSitesSite&& other);
virtual ~ExploreSitesSite(); virtual ~ExploreSitesSite();
...@@ -34,7 +34,7 @@ struct ExploreSitesSite { ...@@ -34,7 +34,7 @@ struct ExploreSitesSite {
int category_id; int category_id;
GURL url; GURL url;
std::string title; std::string title;
bool is_blacklisted; bool is_blocked;
DISALLOW_COPY_AND_ASSIGN(ExploreSitesSite); DISALLOW_COPY_AND_ASSIGN(ExploreSitesSite);
}; };
...@@ -89,7 +89,7 @@ enum class ExploreSitesRequestStatus { ...@@ -89,7 +89,7 @@ enum class ExploreSitesRequestStatus {
// Request failed with error indicating that the request can not be serviced // Request failed with error indicating that the request can not be serviced
// by the server. // by the server.
kShouldSuspendBadRequest = 2, kShouldSuspendBadRequest = 2,
// The request was blocked by a URL blacklist configured by the domain // The request was blocked by a URL blocklist configured by the domain
// administrator. // administrator.
kShouldSuspendBlockedByAdministrator = 3, kShouldSuspendBlockedByAdministrator = 3,
// kMaxValue should always be the last type. // kMaxValue should always be the last type.
......
...@@ -147,12 +147,11 @@ GetCatalogSync(bool update_current, sql::Database* db) { ...@@ -147,12 +147,11 @@ GetCatalogSync(bool update_current, sql::Database* db) {
site_statement.BindInt64(0, category.category_id); site_statement.BindInt64(0, category.category_id);
while (site_statement.Step()) { while (site_statement.Step()) {
category.sites.emplace_back( category.sites.emplace_back(site_statement.ColumnInt(0), // site_id
site_statement.ColumnInt(0), // site_id
category.category_id, category.category_id,
GURL(site_statement.ColumnString(1)), // url GURL(site_statement.ColumnString(1)), // url
site_statement.ColumnString(2), // title site_statement.ColumnString(2), // title
site_statement.ColumnBool(3)); // is_blacklisted site_statement.ColumnBool(3)); // is_blocked
} }
if (!site_statement.Succeeded()) if (!site_statement.Succeeded())
return std::make_pair(GetCatalogStatus::kFailed, nullptr); return std::make_pair(GetCatalogStatus::kFailed, nullptr);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/test/bind_test_util.h" #include "base/test/bind_test_util.h"
#include "base/test/mock_callback.h" #include "base/test/mock_callback.h"
#include "chrome/browser/android/explore_sites/blacklist_site_task.h" #include "chrome/browser/android/explore_sites/block_site_task.h"
#include "chrome/browser/android/explore_sites/explore_sites_schema.h" #include "chrome/browser/android/explore_sites/explore_sites_schema.h"
#include "components/offline_pages/task/task.h" #include "components/offline_pages/task/task.h"
#include "components/offline_pages/task/task_test_base.h" #include "components/offline_pages/task/task_test_base.h"
...@@ -42,7 +42,7 @@ void ValidateTestingCatalog(GetCatalogTask::CategoryList* catalog) { ...@@ -42,7 +42,7 @@ void ValidateTestingCatalog(GetCatalogTask::CategoryList* catalog) {
EXPECT_EQ("https://www.example.com/1", site->url.spec()); EXPECT_EQ("https://www.example.com/1", site->url.spec());
EXPECT_EQ(4, site->category_id); EXPECT_EQ(4, site->category_id);
EXPECT_EQ("example_1", site->title); EXPECT_EQ("example_1", site->title);
EXPECT_FALSE(site->is_blacklisted); EXPECT_FALSE(site->is_blocked);
cat = &catalog->at(1); cat = &catalog->at(1);
EXPECT_EQ(5, cat->category_id); EXPECT_EQ(5, cat->category_id);
...@@ -57,11 +57,11 @@ void ValidateTestingCatalog(GetCatalogTask::CategoryList* catalog) { ...@@ -57,11 +57,11 @@ void ValidateTestingCatalog(GetCatalogTask::CategoryList* catalog) {
EXPECT_EQ("https://www.example.com/2", site->url.spec()); EXPECT_EQ("https://www.example.com/2", site->url.spec());
EXPECT_EQ(5, site->category_id); EXPECT_EQ(5, site->category_id);
EXPECT_EQ("example_2", site->title); EXPECT_EQ("example_2", site->title);
EXPECT_FALSE(site->is_blacklisted); EXPECT_FALSE(site->is_blocked);
} }
// Same as above, sites blacklisted are clearly marked. // Same as above, blocked sites are clearly marked.
void ValidateBlacklistTestingCatalog(GetCatalogTask::CategoryList* catalog) { void ValidateBlockedSitesTestingCatalog(GetCatalogTask::CategoryList* catalog) {
EXPECT_FALSE(catalog == nullptr); EXPECT_FALSE(catalog == nullptr);
EXPECT_EQ(2U, catalog->size()); EXPECT_EQ(2U, catalog->size());
...@@ -78,7 +78,7 @@ void ValidateBlacklistTestingCatalog(GetCatalogTask::CategoryList* catalog) { ...@@ -78,7 +78,7 @@ void ValidateBlacklistTestingCatalog(GetCatalogTask::CategoryList* catalog) {
EXPECT_EQ("https://www.example.com/1", site->url.spec()); EXPECT_EQ("https://www.example.com/1", site->url.spec());
EXPECT_EQ(4, site->category_id); EXPECT_EQ(4, site->category_id);
EXPECT_EQ("example_1", site->title); EXPECT_EQ("example_1", site->title);
EXPECT_FALSE(site->is_blacklisted); EXPECT_FALSE(site->is_blocked);
cat = &catalog->at(1); cat = &catalog->at(1);
EXPECT_EQ(5, cat->category_id); EXPECT_EQ(5, cat->category_id);
...@@ -93,7 +93,7 @@ void ValidateBlacklistTestingCatalog(GetCatalogTask::CategoryList* catalog) { ...@@ -93,7 +93,7 @@ void ValidateBlacklistTestingCatalog(GetCatalogTask::CategoryList* catalog) {
EXPECT_EQ("https://www.example.com/2", site->url.spec()); EXPECT_EQ("https://www.example.com/2", site->url.spec());
EXPECT_EQ(5, site->category_id); EXPECT_EQ(5, site->category_id);
EXPECT_EQ("example_2", site->title); EXPECT_EQ("example_2", site->title);
EXPECT_TRUE(site->is_blacklisted); EXPECT_TRUE(site->is_blocked);
} }
void ExpectSuccessGetCatalogResult( void ExpectSuccessGetCatalogResult(
...@@ -103,11 +103,11 @@ void ExpectSuccessGetCatalogResult( ...@@ -103,11 +103,11 @@ void ExpectSuccessGetCatalogResult(
ValidateTestingCatalog(catalog.get()); ValidateTestingCatalog(catalog.get());
} }
void ExpectBlacklistGetCatalogResult( void ExpectBlockedGetCatalogResult(
GetCatalogStatus status, GetCatalogStatus status,
std::unique_ptr<GetCatalogTask::CategoryList> catalog) { std::unique_ptr<GetCatalogTask::CategoryList> catalog) {
EXPECT_EQ(GetCatalogStatus::kSuccess, status); EXPECT_EQ(GetCatalogStatus::kSuccess, status);
ValidateBlacklistTestingCatalog(catalog.get()); ValidateBlockedSitesTestingCatalog(catalog.get());
} }
void ExpectEmptyGetCatalogResult( void ExpectEmptyGetCatalogResult(
...@@ -151,7 +151,7 @@ class ExploreSitesGetCatalogTaskTest : public TaskTestBase { ...@@ -151,7 +151,7 @@ class ExploreSitesGetCatalogTaskTest : public TaskTestBase {
std::pair<std::string, std::string> GetCurrentAndDownloadingVersion(); std::pair<std::string, std::string> GetCurrentAndDownloadingVersion();
int GetNumberOfCategoriesInDB(); int GetNumberOfCategoriesInDB();
int GetNumberOfSitesInDB(); int GetNumberOfSitesInDB();
void BlacklistSite(std::string url); void BlockSite(std::string url);
private: private:
std::unique_ptr<ExploreSitesStore> store_; std::unique_ptr<ExploreSitesStore> store_;
...@@ -263,10 +263,10 @@ int ExploreSitesGetCatalogTaskTest::GetNumberOfSitesInDB() { ...@@ -263,10 +263,10 @@ int ExploreSitesGetCatalogTaskTest::GetNumberOfSitesInDB() {
return result; return result;
} }
void ExploreSitesGetCatalogTaskTest::BlacklistSite(std::string url) { void ExploreSitesGetCatalogTaskTest::BlockSite(std::string url) {
BlacklistSiteTask task(store(), url); BlockSiteTask task(store(), url);
RunTask(&task); RunTask(&task);
// We don't actively wait for completion, so we rely on the blacklist request // We don't actively wait for completion, so we rely on the block request
// clearing the task queue before the task in the test proper runs. // clearing the task queue before the task in the test proper runs.
} }
...@@ -299,13 +299,13 @@ TEST_F(ExploreSitesGetCatalogTaskTest, SimpleCatalog) { ...@@ -299,13 +299,13 @@ TEST_F(ExploreSitesGetCatalogTaskTest, SimpleCatalog) {
EXPECT_EQ(4, GetNumberOfSitesInDB()); EXPECT_EQ(4, GetNumberOfSitesInDB());
} }
// This tests that sites on the blacklist do not show up when we do a get // This tests that blocked sites do not show up when we do a get
// catalog task. // catalog task.
TEST_F(ExploreSitesGetCatalogTaskTest, BlasklistedSitesMarkedBlacklisted) { TEST_F(ExploreSitesGetCatalogTaskTest, BlasklistedSitesMarkedAsBlocked) {
BlacklistSite("https://www.example.com/2"); BlockSite("https://www.example.com/2");
PopulateTestingCatalog(); PopulateTestingCatalog();
GetCatalogTask task(store(), false, GetCatalogTask task(store(), false,
base::BindOnce(&ExpectBlacklistGetCatalogResult)); base::BindOnce(&ExpectBlockedGetCatalogResult));
RunTask(&task); RunTask(&task);
} }
......
...@@ -179,7 +179,7 @@ TEST_F(ExploreSitesGetImagesTaskTest, SiteExistsAndHasFavicon) { ...@@ -179,7 +179,7 @@ TEST_F(ExploreSitesGetImagesTaskTest, SiteExistsAndHasFavicon) {
EXPECT_EQ("bytes3", std::string(result3.begin(), result3.end())); EXPECT_EQ("bytes3", std::string(result3.begin(), result3.end()));
} }
TEST_F(ExploreSitesGetImagesTaskTest, SitesExistAndNotBlacklisted) { TEST_F(ExploreSitesGetImagesTaskTest, SitesExistAndNotBlocked) {
PopulateTestingCatalog(); PopulateTestingCatalog();
GetImagesTask task(store(), 3, 4, StoreResult()); GetImagesTask task(store(), 3, 4, StoreResult());
RunTask(&task); RunTask(&task);
...@@ -191,7 +191,7 @@ TEST_F(ExploreSitesGetImagesTaskTest, SitesExistAndNotBlacklisted) { ...@@ -191,7 +191,7 @@ TEST_F(ExploreSitesGetImagesTaskTest, SitesExistAndNotBlacklisted) {
EXPECT_EQ("bytes3", std::string(result2.begin(), result2.end())); EXPECT_EQ("bytes3", std::string(result2.begin(), result2.end()));
} }
TEST_F(ExploreSitesGetImagesTaskTest, SitesExistAndBlacklisted) { TEST_F(ExploreSitesGetImagesTaskTest, SitesExistAndBlocked) {
PopulateTestingCatalog(); PopulateTestingCatalog();
ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) { ExecuteSync(base::BindLambdaForTesting([&](sql::Database* db) {
sql::Statement insert(db->GetUniqueStatement(R"( sql::Statement insert(db->GetUniqueStatement(R"(
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
namespace explore_sites { namespace explore_sites {
// Takes a URL that the user has asked us to remove, and adds it to a blacklist // Takes a URL that the user has asked us to remove, and adds it to a blocklist
// of sites we will stop showing in Explore on Sites. // of sites we will stop showing in Explore on Sites.
class MostVisitedClient class MostVisitedClient
: public ntp_tiles::MostVisitedSites::ExploreSitesClient { : public ntp_tiles::MostVisitedSites::ExploreSitesClient {
......
...@@ -3784,7 +3784,7 @@ test("unit_tests") { ...@@ -3784,7 +3784,7 @@ test("unit_tests") {
"../browser/android/contextualsearch/contextual_search_delegate_unittest.cc", "../browser/android/contextualsearch/contextual_search_delegate_unittest.cc",
"../browser/android/contextualsearch/contextual_search_field_trial_unittest.cc", "../browser/android/contextualsearch/contextual_search_field_trial_unittest.cc",
"../browser/android/customtabs/detached_resource_request_unittest.cc", "../browser/android/customtabs/detached_resource_request_unittest.cc",
"../browser/android/explore_sites/blacklist_site_task_unittest.cc", "../browser/android/explore_sites/block_site_task_unittest.cc",
"../browser/android/explore_sites/clear_activities_task_unittest.cc", "../browser/android/explore_sites/clear_activities_task_unittest.cc",
"../browser/android/explore_sites/clear_catalog_task_unittest.cc", "../browser/android/explore_sites/clear_catalog_task_unittest.cc",
"../browser/android/explore_sites/explore_sites_feature_unittest.cc", "../browser/android/explore_sites/explore_sites_feature_unittest.cc",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment