Remove released CacheOnlyCertainUrlClassifications flag
Bug: b:272209467 Change-Id: I96269973925bfff5ee590a0eb6f92a6e78ce030f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4846671 Commit-Queue: Marc Treib <treib@chromium.org> Auto-Submit: Tomek Jurkiewicz <tju@google.com> Commit-Queue: Tomek Jurkiewicz <tju@google.com> Reviewed-by: Marc Treib <treib@chromium.org> Cr-Commit-Position: refs/heads/main@{#1193470}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
0aaac5e47a
commit
dfe4f6e7fa
components/safe_search_api
@ -7,7 +7,6 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "base/feature_list.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/logging.h"
|
||||
@ -17,22 +16,9 @@
|
||||
|
||||
namespace safe_search_api {
|
||||
|
||||
BASE_FEATURE(kCacheOnlyCertainUrlClassifications,
|
||||
"CacheOnlyCertainUrlClassifications",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
namespace {
|
||||
bool ShouldCacheUrlClassification(bool is_uncertain) {
|
||||
if (!is_uncertain) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !base::FeatureList::IsEnabled(kCacheOnlyCertainUrlClassifications);
|
||||
}
|
||||
|
||||
const size_t kDefaultCacheSize = 1000;
|
||||
const size_t kDefaultCacheTimeoutSeconds = 3600;
|
||||
|
||||
} // namespace
|
||||
|
||||
struct URLChecker::Check {
|
||||
@ -116,7 +102,7 @@ void URLChecker::OnAsyncCheckComplete(CheckList::iterator it,
|
||||
std::vector<CheckCallback> callbacks = std::move(it->get()->callbacks);
|
||||
checks_in_progress_.erase(it);
|
||||
|
||||
if (ShouldCacheUrlClassification(uncertain)) {
|
||||
if (!uncertain) {
|
||||
cache_.Put(url, CheckResult(classification, uncertain));
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/containers/lru_cache.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/functional/callback_forward.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/time/time.h"
|
||||
@ -18,10 +17,6 @@
|
||||
|
||||
namespace safe_search_api {
|
||||
|
||||
// Controls caching for unknown url classifications. Such status might be a
|
||||
// result of any problem during classification. See b/272209467 for details.
|
||||
BASE_DECLARE_FEATURE(kCacheOnlyCertainUrlClassifications);
|
||||
|
||||
// The SafeSearch API classification of a URL.
|
||||
enum class Classification { SAFE, UNSAFE };
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "components/safe_search_api/fake_url_checker_client.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
@ -175,10 +174,6 @@ TEST_F(SafeSearchURLCheckerTest, CacheTimeout) {
|
||||
}
|
||||
|
||||
TEST_F(SafeSearchURLCheckerTest, DoNotCacheUncertainClassifications) {
|
||||
// TODO(b/272209467): Remove when uncertain classifications are never cached.
|
||||
base::test::ScopedFeatureList enable_feature{
|
||||
kCacheOnlyCertainUrlClassifications};
|
||||
|
||||
GURL url(GetNewURL());
|
||||
|
||||
ASSERT_FALSE(SendResponse(
|
||||
@ -187,19 +182,6 @@ TEST_F(SafeSearchURLCheckerTest, DoNotCacheUncertainClassifications) {
|
||||
EXPECT_FALSE(CheckURL(url)); // And so was the second one.
|
||||
}
|
||||
|
||||
TEST_F(SafeSearchURLCheckerTest, CacheUncertainClassifications) {
|
||||
base::test::ScopedFeatureList disable_feature;
|
||||
disable_feature.InitAndDisableFeature(kCacheOnlyCertainUrlClassifications);
|
||||
GURL url(GetNewURL());
|
||||
|
||||
ASSERT_FALSE(
|
||||
SendResponse(url, Classification::SAFE,
|
||||
/*uncertain=*/true)); // First check was asynchronous
|
||||
// (uncached), but is cached.
|
||||
EXPECT_TRUE(
|
||||
CheckURL(url)); // Then, second check is synchronous (from cache).
|
||||
}
|
||||
|
||||
TEST_F(SafeSearchURLCheckerTest, DestroyURLCheckerBeforeCallback) {
|
||||
GURL url(GetNewURL());
|
||||
EXPECT_CALL(*this, OnCheckDone(_, _, _)).Times(0);
|
||||
|
Reference in New Issue
Block a user