Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / extensions / updater / extension_cache_fake.h
blobd7b0fde9d6e39394964d003cb1178b1776324e5f
1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_CACHE_FAKE_H_
6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_CACHE_FAKE_H_
8 #include <map>
9 #include <set>
10 #include <string>
12 #include "extensions/browser/updater/extension_cache.h"
14 namespace extensions {
16 // Fake implementation of extensions ExtensionCache that can be used in tests.
17 class ExtensionCacheFake : public ExtensionCache {
18 public:
19 ExtensionCacheFake();
20 ~ExtensionCacheFake() override;
22 // Implementation of ExtensionCache.
23 void Start(const base::Closure& callback) override;
24 void Shutdown(const base::Closure& callback) override;
25 void AllowCaching(const std::string& id) override;
26 bool GetExtension(const std::string& id,
27 const std::string& expected_hash,
28 base::FilePath* file_path,
29 std::string* version) override;
30 void PutExtension(const std::string& id,
31 const std::string& expected_hash,
32 const base::FilePath& file_path,
33 const std::string& version,
34 const PutExtensionCallback& callback) override;
36 private:
37 typedef std::map<std::string, std::pair<std::string, base::FilePath> > Map;
38 // Set of extensions that can be cached.
39 std::set<std::string> allowed_extensions_;
41 // Map of know extensions.
42 Map cache_;
44 DISALLOW_COPY_AND_ASSIGN(ExtensionCacheFake);
47 } // namespace extensions
49 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_CACHE_FAKE_H_