2022-08-03 02:51:02 +02:00
|
|
|
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2024-05-23 21:39:07 +02:00
|
|
|
#include "base/feature_list.h"
|
2024-06-14 19:01:45 +02:00
|
|
|
#include "base/features.h"
|
2022-08-03 02:51:02 +02:00
|
|
|
#include "base/files/file_path.h"
|
|
|
|
#include "base/path_service.h"
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/include/test/cef_test_helpers.h"
|
2024-05-23 21:39:07 +02:00
|
|
|
#include "services/network/public/cpp/features.h"
|
2022-08-03 02:51:02 +02:00
|
|
|
|
|
|
|
void CefSetDataDirectoryForTests(const CefString& dir) {
|
|
|
|
base::PathService::OverrideAndCreateIfNeeded(
|
|
|
|
base::DIR_SRC_TEST_DATA_ROOT, base::FilePath(dir), /*is_absolute=*/true,
|
|
|
|
/*create=*/false);
|
|
|
|
}
|
2024-05-23 21:39:07 +02:00
|
|
|
|
|
|
|
bool CefIsFeatureEnabledForTests(const CefString& feature_name) {
|
|
|
|
// Only includes values that are queried by unit tests.
|
|
|
|
const base::Feature* features[] = {
|
2024-06-14 19:01:45 +02:00
|
|
|
&base::features::kUseRustJsonParser,
|
2024-05-23 21:39:07 +02:00
|
|
|
&network::features::kReduceAcceptLanguage,
|
|
|
|
};
|
|
|
|
|
|
|
|
const std::string& name = feature_name;
|
|
|
|
for (auto* feature : features) {
|
|
|
|
if (feature->name == name) {
|
|
|
|
return base::FeatureList::IsEnabled(*feature);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LOG(FATAL) << "Feature " << name << " is not supported";
|
|
|
|
}
|