Skip to content

Commit

Permalink
Delete logic related to data reduction proxy config
Browse files Browse the repository at this point in the history
This is no longer needed. Also, remove some of the
unnecessary dependencies.

Change-Id: I806363990684cb99e6dffd62f92e4e73ad3e76b1
Bug: 1173046
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2646663
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Reviewed-by: Dominic Battré <battre@chromium.org>
Reviewed-by: Ramin Halavati <rhalavati@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Robert Ogden <robertogden@chromium.org>
Cr-Commit-Position: refs/heads/master@{#850328}
  • Loading branch information
Tarun Bansal authored and Chromium LUCI CQ committed Feb 3, 2021
1 parent a20abfb commit 564843d
Show file tree
Hide file tree
Showing 44 changed files with 52 additions and 3,857 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ void DataReductionProxyChromeSettings::InitDataReductionProxySettings(
->GetURLLoaderFactoryForBrowserProcess();
std::unique_ptr<data_reduction_proxy::DataReductionProxyService> service =
std::make_unique<data_reduction_proxy::DataReductionProxyService>(
this, profile_prefs, url_loader_factory, std::move(store),
g_browser_process->network_quality_tracker(),
content::GetNetworkConnectionTracker(),
this, profile_prefs, std::move(store),
data_use_measurement::ChromeDataUseMeasurement::GetInstance(),
db_task_runner, commit_delay, GetClient(),
version_info::GetChannelString(chrome::GetChannel()),
Expand Down Expand Up @@ -270,10 +268,6 @@ DataReductionProxyChromeSettings::CreateDataFromNavigationHandle(
// - request_info_
auto data = std::make_unique<data_reduction_proxy::DataReductionProxyData>();
data->set_request_url(handle->GetURL());
data->set_effective_connection_type(
data_reduction_proxy_service()->GetEffectiveConnectionType());
data->set_connection_type(net::NetworkChangeNotifier::ConnectionType(
data_reduction_proxy_service()->GetConnectionType()));
data->set_used_data_reduction_proxy(false);

if (!headers || headers->IsRedirect(nullptr))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
#include "components/keyed_service/core/keyed_service.h"
#include "net/http/http_response_headers.h"

class PrefService;
class Profile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h"
#include "components/data_reduction_proxy/proto/client_config.pb.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
#include "components/proxy_config/proxy_config_pref_names.h"
#include "content/public/test/mock_navigation_handle.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/test/test_network_connection_tracker.h"
#include "services/network/test/test_network_quality_tracker.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {
Expand All @@ -34,8 +30,6 @@ class DataReductionProxyChromeSettingsTest
public:
void SetUp() override {
ChromeRenderViewHostTestHarness::SetUp();
network::TestNetworkConnectionTracker::GetInstance()->SetConnectionType(
network::mojom::ConnectionType::CONNECTION_4G);
auto settings = std::make_unique<DataReductionProxyChromeSettings>(false);
drp_chrome_settings_ = settings.get();
test_context_ =
Expand All @@ -45,9 +39,6 @@ class DataReductionProxyChromeSettingsTest
.Build();
net::ProxyList proxies;
proxies.SetFromPacString(kProxyPac);
test_context_->test_network_quality_tracker()
->ReportEffectiveConnectionTypeForTesting(
net::EFFECTIVE_CONNECTION_TYPE_4G);
dict_ = std::make_unique<base::DictionaryValue>();

PrefRegistrySimple* registry = test_context_->pref_service()->registry();
Expand Down
74 changes: 0 additions & 74 deletions chrome/browser/data_saver/data_saver_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,20 +231,6 @@ class DataSaverWithServerBrowserTest : public InProcessBrowserTest {
SetDataSaverEnabled(browser()->profile(), enabled);
}

net::EffectiveConnectionType GetEffectiveConnectionType() const {
return DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
browser()->profile())
->data_reduction_proxy_service()
->GetEffectiveConnectionType();
}

base::Optional<base::TimeDelta> GetHttpRttEstimate() const {
return DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
browser()->profile())
->data_reduction_proxy_service()
->GetHttpRttEstimate();
}

std::unique_ptr<net::test_server::HttpResponse> VerifySaveDataHeader(
const net::test_server::HttpRequest& request) {
auto save_data_header_it = request.headers.find("save-data");
Expand Down Expand Up @@ -295,66 +281,6 @@ IN_PROC_BROWSER_TEST_F(DataSaverWithServerBrowserTest, ReloadPage) {
browser()->tab_strip_model()->GetActiveWebContents()));
}

// Test that the data saver receives changes in effective connection type.
IN_PROC_BROWSER_TEST_F(DataSaverWithServerBrowserTest,
EffectiveConnectionType) {
Init();

// Add a test observer. To determine if data reduction proxy component has
// received the network quality change notification, we check if the test
// observer has received the notification. Note that all the observers are
// notified in the same message loop by the network quality tracker.
TestEffectiveConnectionTypeObserver observer(
g_browser_process->network_quality_tracker());

g_browser_process->network_quality_tracker()
->ReportEffectiveConnectionTypeForTesting(
net::EFFECTIVE_CONNECTION_TYPE_4G);
observer.WaitForNotification(net::EFFECTIVE_CONNECTION_TYPE_4G);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_4G, GetEffectiveConnectionType());

g_browser_process->network_quality_tracker()
->ReportEffectiveConnectionTypeForTesting(
net::EFFECTIVE_CONNECTION_TYPE_2G);
observer.WaitForNotification(net::EFFECTIVE_CONNECTION_TYPE_2G);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_2G, GetEffectiveConnectionType());

g_browser_process->network_quality_tracker()
->ReportEffectiveConnectionTypeForTesting(
net::EFFECTIVE_CONNECTION_TYPE_3G);
observer.WaitForNotification(net::EFFECTIVE_CONNECTION_TYPE_3G);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_3G, GetEffectiveConnectionType());
}

// Test that the data saver receives changes in HTTP RTT estimate.
IN_PROC_BROWSER_TEST_F(DataSaverWithServerBrowserTest, HttpRttEstimate) {
Init();

// Add a test observer. To determine if data reduction proxy component has
// received the network quality change notification, we check if the test
// observer has received the notification. Note that all the observers are
// notified in the same message loop by the network quality tracker.
TestRTTAndThroughputEstimatesObserver observer(
g_browser_process->network_quality_tracker());

g_browser_process->network_quality_tracker()
->ReportRTTsAndThroughputForTesting(
base::TimeDelta::FromMilliseconds(100), 0);
observer.WaitForNotification(base::TimeDelta::FromMilliseconds(100));
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::TimeDelta::FromMilliseconds(100), GetHttpRttEstimate());

g_browser_process->network_quality_tracker()
->ReportRTTsAndThroughputForTesting(
base::TimeDelta::FromMilliseconds(500), 0);
observer.WaitForNotification(base::TimeDelta::FromMilliseconds(500));
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::TimeDelta::FromMilliseconds(500), GetHttpRttEstimate());
}

class DataSaverForWorkerBrowserTest : public InProcessBrowserTest,
public testing::WithParamInterface<bool> {
protected:
Expand Down
11 changes: 0 additions & 11 deletions chrome/browser/net/profile_network_context_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h"
#include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h"
#include "chrome/browser/domain_reliability/service_factory.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/profiles/profile.h"
Expand Down Expand Up @@ -813,15 +811,6 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
metrics::prefs::kMetricsReportingEnabled);
}

auto* drp_settings =
DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile_);
if (drp_settings) {
mojo::Remote<network::mojom::CustomProxyConfigClient> config_client;
network_context_params->custom_proxy_config_client_receiver =
config_client.BindNewPipeAndPassReceiver();
drp_settings->AddCustomProxyConfigClient(std::move(config_client));
}

#if BUILDFLAG(IS_CHROMEOS_ASH)
bool profile_supports_policy_certs = false;
if (chromeos::ProfileHelper::IsSigninProfile(profile_))
Expand Down
9 changes: 9 additions & 0 deletions chrome/browser/prefs/browser_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,10 @@ const char kAssistantQuickAnswersEnabled[] =
// Deprecated 01/2021
const char kGoogleServicesHostedDomain[] = "google.services.hosted_domain";

const char kDataReductionProxyLastConfigRetrievalTime[] =
"data_reduction.last_config_retrieval_time";
const char kDataReductionProxyConfig[] = "data_reduction.config";

// Register local state used only for migration (clearing or moving to a new
// key).
void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
Expand Down Expand Up @@ -632,6 +636,9 @@ void RegisterProfilePrefsForMigration(
registry->RegisterBooleanPref(kAssistantQuickAnswersEnabled, true);

registry->RegisterStringPref(kGoogleServicesHostedDomain, std::string());

registry->RegisterInt64Pref(kDataReductionProxyLastConfigRetrievalTime, 0L);
registry->RegisterStringPref(kDataReductionProxyConfig, std::string());
}

} // namespace
Expand Down Expand Up @@ -1291,6 +1298,8 @@ void MigrateObsoleteProfilePrefs(Profile* profile) {

// Added 01/2021
profile_prefs->ClearPref(kGoogleServicesHostedDomain);
profile_prefs->ClearPref(kDataReductionProxyLastConfigRetrievalTime);
profile_prefs->ClearPref(kDataReductionProxyConfig);

// Please don't delete the following line. It is used by PRESUBMIT.py.
// END_MIGRATE_OBSOLETE_PROFILE_PREFS
Expand Down
3 changes: 1 addition & 2 deletions components/data_reduction_proxy/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ include_rules = [
"+components/pref_registry",
"+components/prefs",
"+components/previews/core",
"+components/variations",
"+crypto",
"+google_apis",
"+mojo/public/cpp",
"+net",
"+mojo/public/cpp",
"+services/network/public/cpp",
"+services/network/public/mojom",

Expand Down
15 changes: 1 addition & 14 deletions components/data_reduction_proxy/core/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ if (is_android) {
browser_sources = [
"data_reduction_proxy_compression_stats.cc",
"data_reduction_proxy_compression_stats.h",
"data_reduction_proxy_config_service_client.cc",
"data_reduction_proxy_config_service_client.h",
"data_reduction_proxy_data.cc",
"data_reduction_proxy_data.h",
"data_reduction_proxy_metrics.h",
Expand Down Expand Up @@ -45,12 +43,9 @@ if (is_android) {
"//components/pref_registry",
"//components/prefs",
"//components/previews/core:core",
"//components/variations",
"//components/variations/net",
"//crypto",
"//google_apis",
"//net:net",
"//services/network/public/cpp",
"//url:url",
]
}
Expand Down Expand Up @@ -78,8 +73,6 @@ static_library("browser") {
"//components/pref_registry",
"//components/prefs",
"//components/previews/core:core",
"//components/variations",
"//components/variations/net",
"//crypto",
"//google_apis",
"//net",
Expand All @@ -98,8 +91,6 @@ static_library("browser") {
static_library("test_support") {
testonly = true
sources = [
"data_reduction_proxy_config_service_client_test_utils.cc",
"data_reduction_proxy_config_service_client_test_utils.h",
"data_reduction_proxy_settings_test_utils.cc",
"data_reduction_proxy_settings_test_utils.h",
"data_reduction_proxy_test_utils.cc",
Expand Down Expand Up @@ -146,13 +137,10 @@ source_set("unit_tests") {
testonly = true
sources = [
"data_reduction_proxy_compression_stats_unittest.cc",
"data_reduction_proxy_config_service_client_unittest.cc",
"data_reduction_proxy_data_unittest.cc",
"data_reduction_proxy_prefs_unittest.cc",
"data_reduction_proxy_request_options_unittest.cc",
"data_reduction_proxy_service_unittest.cc",
"data_reduction_proxy_settings_unittest.cc",
"data_reduction_proxy_util_unittest.cc",
"data_usage_store_unittest.cc",
]

Expand All @@ -170,10 +158,9 @@ source_set("unit_tests") {
"//components/data_use_measurement/core:ascriber",
"//components/prefs:test_support",
"//components/previews/core",
"//components/variations",
"//net:test_support",
"//services/network:network_service",
"//services/network:test_support",
"//services/network/public/cpp",
"//testing/gmock",
"//testing/gtest",
]
Expand Down
Loading

0 comments on commit 564843d

Please sign in to comment.