blob: d7093cad399ff1f8773ede52c17b2e2623a27e47 [file] [log] [blame]
Alan Cutterb81d0e02020-08-05 09:10:341// Copyright 2020 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_TESTING_LOADER_H_
6#define CHROME_BROWSER_EXTENSIONS_EXTERNAL_TESTING_LOADER_H_
7
8#include <memory>
9
10#include "base/files/file_path.h"
11#include "base/memory/ref_counted.h"
12#include "chrome/browser/extensions/external_loader.h"
13
14namespace base {
15class DictionaryValue;
16}
17
18namespace extensions {
19
20// A simplified version of ExternalPrefLoader that loads the dictionary
21// from json data specified in a string.
22class ExternalTestingLoader : public ExternalLoader {
23 public:
24 ExternalTestingLoader(const std::string& json_data,
25 const base::FilePath& fake_base_path);
26 ExternalTestingLoader(const ExternalTestingLoader&) = delete;
27 ExternalTestingLoader& operator=(const ExternalTestingLoader&) = delete;
28
29 // ExternalLoader:
30 const base::FilePath GetBaseCrxFilePath() override;
31
32 void StartLoading() override;
33
34 private:
35 friend class base::RefCountedThreadSafe<ExternalLoader>;
36
37 ~ExternalTestingLoader() override;
38
39 base::FilePath fake_base_path_;
40 std::unique_ptr<base::DictionaryValue> testing_prefs_;
41};
42
43} // namespace extensions
44
45#endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_TESTING_LOADER_H_