Files
brave-core/updater/configurator_unittest.cc
T
Michael Herrmann c9f6debc71 Improve update request privacy (#31127)
* Don't send any contents of the hw object
 * Never send app/lang
 * Don't send download_time_ms

The motivation is that these could otherwise potentially be used to
fingerprint users.
2025-09-29 16:54:35 +02:00

50 lines
1.8 KiB
C++

/* Copyright (c) 2025 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */
#include "chrome/updater/configurator.h"
#include <utility>
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
#include "base/test/task_environment.h"
#include "brave/components/update_client/test_util.h"
#include "chrome/updater/external_constants.h"
#include "chrome/updater/persisted_data.h"
#include "chrome/updater/prefs_impl.h"
#include "chrome/updater/updater_scope.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
#include "components/update_client/protocol_handler.h"
#include "components/update_client/protocol_serializer.h"
#include "components/update_client/update_client.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace updater {
TEST(Configurator, UsesPrivacyPreservingProtocolSerializer) {
base::test::TaskEnvironment task_environment;
auto pref_service = std::make_unique<TestingPrefServiceSimple>();
update_client::RegisterPrefs(pref_service->registry());
RegisterPersistedDataPrefs(pref_service->registry());
auto prefs = base::MakeRefCounted<UpdaterPrefsImpl>(base::FilePath(), nullptr,
std::move(pref_service));
auto external_constants = CreateExternalConstants();
auto configurator = base::MakeRefCounted<Configurator>(
prefs, external_constants, UpdaterScope::kUser);
auto factory = configurator->GetProtocolHandlerFactory();
ASSERT_TRUE(factory);
auto serializer = factory->CreateSerializer();
ASSERT_TRUE(serializer);
EXPECT_TRUE(update_client::StripsPrivacySensitiveData(*serializer));
}
} // namespace updater