Commit 2fc65b06 authored by Olya Kalitova's avatar Olya Kalitova Committed by Commit Bot

Initialize DBusThreadManager for policy_fuzzer

Initializes DBusThreadManager and CommandLine needed as a part of a
policy_fuzzer setup.

Bug: 1015318
Change-Id: I76255d093420b0975d5adec2feb50826d6027242
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1926492Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Olya Kalitova <okalitova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717621}
parent 63228864
......@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h"
#include "chrome/browser/chromeos/policy/fuzzer/policy_fuzzer.pb.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/policy/core/common/external_data_manager.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_types.h"
......@@ -13,13 +15,21 @@
namespace policy {
bool FuzzTestInitializer() {
base::CommandLine::Init(0, nullptr);
chromeos::DBusThreadManager::Initialize();
return true;
}
DEFINE_PROTO_FUZZER(const PolicyFuzzerProto& proto) {
static bool initialized = FuzzTestInitializer();
CHECK(initialized);
if (!proto.has_chrome_device_settings())
return;
const enterprise_management::ChromeDeviceSettingsProto&
chrome_device_settings = proto.chrome_device_settings();
base::WeakPtr<ExternalDataManager> data_manager;
PolicyMap policy_map;
DecodeDevicePolicy(chrome_device_settings, data_manager, &policy_map);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment