blob: 7826a6e6f8d44360e660a75cfc4db3d07b3e1e75 [file] [log] [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_TESTING_LOADER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTERNAL_TESTING_LOADER_H_
#include <memory>
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/values.h"
#include "chrome/browser/extensions/external_loader.h"
#include "extensions/buildflags/buildflags.h"
static_assert(BUILDFLAG(ENABLE_EXTENSIONS_CORE));
namespace extensions {
// A simplified version of ExternalPrefLoader that loads the dictionary
// from json data specified in a string.
class ExternalTestingLoader : public ExternalLoader {
public:
ExternalTestingLoader(const std::string& json_data,
const base::FilePath& fake_base_path);
ExternalTestingLoader(const ExternalTestingLoader&) = delete;
ExternalTestingLoader& operator=(const ExternalTestingLoader&) = delete;
// ExternalLoader:
const base::FilePath GetBaseCrxFilePath() override;
void StartLoading() override;
private:
friend class base::RefCountedThreadSafe<ExternalLoader>;
~ExternalTestingLoader() override;
base::FilePath fake_base_path_;
base::Value::Dict testing_prefs_;
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_TESTING_LOADER_H_