Remove unused flag
This was only intended to be temporary (see linked bug), and is not enabled. Bug: 859097 Change-Id: I74f510f1898fd901608a2acd1b6cc83d401903c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3723263 Reviewed-by: Marc Treib <treib@chromium.org> Auto-Submit: James Lee <ljjlee@google.com> Commit-Queue: Marc Treib <treib@chromium.org> Commit-Queue: James Lee <ljjlee@google.com> Cr-Commit-Position: refs/heads/main@{#1018192}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
24393019c1
commit
12b8577263
components/safe_search_api
@ -18,7 +18,6 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/values.h"
|
||||
#include "components/google/core/common/google_util.h"
|
||||
|
||||
namespace safe_search_api {
|
||||
|
||||
@ -29,10 +28,6 @@ const size_t kDefaultCacheTimeoutSeconds = 3600;
|
||||
|
||||
} // namespace
|
||||
|
||||
// Consider all URLs within a google domain to be safe.
|
||||
const base::Feature kAllowAllGoogleUrls{"SafeSearchAllowAllGoogleURLs",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
struct URLChecker::Check {
|
||||
Check(const GURL& url, CheckCallback callback);
|
||||
~Check();
|
||||
@ -65,23 +60,6 @@ URLChecker::URLChecker(std::unique_ptr<URLCheckerClient> async_checker,
|
||||
URLChecker::~URLChecker() = default;
|
||||
|
||||
bool URLChecker::CheckURL(const GURL& url, CheckCallback callback) {
|
||||
if (base::FeatureList::IsEnabled(kAllowAllGoogleUrls)) {
|
||||
// Hack: For now, allow all Google URLs to save QPS.
|
||||
if (google_util::IsGoogleDomainUrl(url, google_util::ALLOW_SUBDOMAIN,
|
||||
google_util::ALLOW_NON_STANDARD_PORTS)) {
|
||||
std::move(callback).Run(url, Classification::SAFE, false);
|
||||
return true;
|
||||
}
|
||||
// Hack: For now, allow all YouTube URLs since YouTube has its own Safety
|
||||
// Mode anyway.
|
||||
if (google_util::IsYoutubeDomainUrl(
|
||||
url, google_util::ALLOW_SUBDOMAIN,
|
||||
google_util::ALLOW_NON_STANDARD_PORTS)) {
|
||||
std::move(callback).Run(url, Classification::SAFE, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
auto cache_it = cache_.Get(url);
|
||||
if (cache_it != cache_.end()) {
|
||||
const CheckResult& result = cache_it->second;
|
||||
|
@ -15,18 +15,11 @@
|
||||
#include "components/safe_search_api/url_checker_client.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace base {
|
||||
struct Feature;
|
||||
}
|
||||
|
||||
namespace safe_search_api {
|
||||
|
||||
// The SafeSearch API classification of a URL.
|
||||
enum class Classification { SAFE, UNSAFE };
|
||||
|
||||
// Visible for testing.
|
||||
extern const base::Feature kAllowAllGoogleUrls;
|
||||
|
||||
// This class uses one implementation of URLCheckerClient to check the
|
||||
// classification of the content on a given URL and returns the result
|
||||
// asynchronously via a callback. It is also responsible for the synchronous
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "base/bind.h"
|
||||
#include "base/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"
|
||||
@ -162,40 +161,6 @@ TEST_F(SafeSearchURLCheckerTest, CacheTimeout) {
|
||||
ASSERT_FALSE(SendResponse(url, Classification::UNSAFE, false));
|
||||
}
|
||||
|
||||
TEST_F(SafeSearchURLCheckerTest, AllowAllGoogleURLs) {
|
||||
base::test::ScopedFeatureList feature_list;
|
||||
feature_list.InitAndEnableFeature(kAllowAllGoogleUrls);
|
||||
{
|
||||
GURL url("https://sites.google.com/porn");
|
||||
EXPECT_CALL(*this, OnCheckDone(url, Classification::SAFE, _));
|
||||
// No server interaction.
|
||||
bool cache_hit = CheckURL(url);
|
||||
ASSERT_TRUE(cache_hit);
|
||||
}
|
||||
{
|
||||
GURL url("https://youtube.com/porn");
|
||||
EXPECT_CALL(*this, OnCheckDone(url, Classification::SAFE, _));
|
||||
// No server interaction
|
||||
bool cache_hit = CheckURL(url);
|
||||
ASSERT_TRUE(cache_hit);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SafeSearchURLCheckerTest, NoAllowAllGoogleURLs) {
|
||||
base::test::ScopedFeatureList feature_list;
|
||||
feature_list.InitAndDisableFeature(kAllowAllGoogleUrls);
|
||||
{
|
||||
GURL url("https://sites.google.com/porn");
|
||||
EXPECT_CALL(*this, OnCheckDone(url, Classification::UNSAFE, false));
|
||||
ASSERT_FALSE(SendResponse(url, Classification::UNSAFE, false));
|
||||
}
|
||||
{
|
||||
GURL url("https://youtube.com/porn");
|
||||
EXPECT_CALL(*this, OnCheckDone(url, Classification::UNSAFE, false));
|
||||
ASSERT_FALSE(SendResponse(url, Classification::UNSAFE, false));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SafeSearchURLCheckerTest, DestroyURLCheckerBeforeCallback) {
|
||||
GURL url(GetNewURL());
|
||||
EXPECT_CALL(*this, OnCheckDone(_, _, _)).Times(0);
|
||||
|
Reference in New Issue
Block a user