[CodeHealth] Remove pref_service_util::GetAllDottedPaths
Unused since crrev.com/c/6108538. Bug: None Change-Id: I4ff9bec8ae7b8b0e5a80b3b62b7e0c25ccb057f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6316769 Reviewed-by: Colin Blundell <blundell@chromium.org> Commit-Queue: Colin Blundell <blundell@chromium.org> Auto-Submit: Andrew Rayskiy <greengrape@google.com> Cr-Commit-Position: refs/heads/main@{#1427605}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
10197a5fa7
commit
51cc784590
components/prefs
@ -27,7 +27,6 @@
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/metrics/histogram.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
@ -41,34 +40,6 @@
|
||||
#include "components/prefs/android/pref_service_android.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
namespace pref_service_util {
|
||||
void GetAllDottedPaths(std::string_view prefix,
|
||||
const base::Value::Dict& dict,
|
||||
std::vector<std::string>& paths) {
|
||||
for (const auto pair : dict) {
|
||||
std::string path;
|
||||
if (prefix.empty()) {
|
||||
path = pair.first;
|
||||
} else {
|
||||
path = base::StrCat({prefix, ".", pair.first});
|
||||
}
|
||||
|
||||
if (pair.second.is_dict()) {
|
||||
GetAllDottedPaths(path, pair.second.GetDict(), paths);
|
||||
} else {
|
||||
paths.push_back(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GetAllDottedPaths(const base::Value::Dict& dict,
|
||||
std::vector<std::string>& paths) {
|
||||
GetAllDottedPaths("", dict, paths);
|
||||
}
|
||||
} // namespace pref_service_util
|
||||
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
|
||||
PrefService::PersistentPrefStoreLoadingObserver::
|
||||
PersistentPrefStoreLoadingObserver(PrefService* pref_service)
|
||||
: pref_service_(pref_service) {
|
||||
|
@ -61,15 +61,6 @@ class PrefMemberBase;
|
||||
class ScopedUserPrefUpdateBase;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
namespace pref_service_util {
|
||||
// Gets all the dotted paths from `dict`. For example if values stored are
|
||||
// `{"a" : { "b" : true, "c": false }}`, then `paths` gets ["a.b", "a.c"].
|
||||
void COMPONENTS_PREFS_EXPORT GetAllDottedPaths(const base::Value::Dict& dict,
|
||||
std::vector<std::string>& paths);
|
||||
} // namespace pref_service_util
|
||||
#endif
|
||||
|
||||
// Base class for PrefServices. You can use the base class to read and
|
||||
// interact with preferences, but not to register new preferences; for
|
||||
// that see e.g. PrefRegistrySimple.
|
||||
|
@ -31,34 +31,6 @@ const char kPrefName[] = "pref.name";
|
||||
|
||||
} // namespace
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
TEST(PrefServiceUtilTest, GetAllDottedPaths) {
|
||||
using pref_service_util::GetAllDottedPaths;
|
||||
|
||||
base::Value::Dict dict;
|
||||
std::vector<std::string> paths;
|
||||
|
||||
GetAllDottedPaths(dict, paths);
|
||||
// Expect paths to be [].
|
||||
EXPECT_EQ(paths.size(), std::size_t(0));
|
||||
|
||||
dict.SetByDottedPath("one.two", base::Value(12));
|
||||
GetAllDottedPaths(dict, paths);
|
||||
EXPECT_THAT(paths, testing::UnorderedElementsAre("one.two"));
|
||||
|
||||
paths.clear();
|
||||
dict.SetByDottedPath("one.three", base::Value(13));
|
||||
GetAllDottedPaths(dict, paths);
|
||||
EXPECT_THAT(paths, testing::UnorderedElementsAre("one.two", "one.three"));
|
||||
|
||||
paths.clear();
|
||||
dict.SetByDottedPath("key", "value");
|
||||
GetAllDottedPaths(dict, paths);
|
||||
EXPECT_THAT(paths,
|
||||
testing::UnorderedElementsAre("one.two", "one.three", "key"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(PrefServiceTest, NoObserverFire) {
|
||||
TestingPrefServiceSimple prefs;
|
||||
|
||||
|
Reference in New Issue
Block a user