NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / extensions / updater / extension_cache_fake.h
blob2c9b3ca74caecb71b8f948f9a1f3eccbeb28275c
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 "chrome/browser/extensions/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 virtual ~ExtensionCacheFake();
22 // Implementation of ExtensionCache.
23 virtual void Start(const base::Closure& callback) OVERRIDE;
24 virtual void Shutdown(const base::Closure& callback) OVERRIDE;
25 virtual void AllowCaching(const std::string& id) OVERRIDE;
26 virtual bool GetExtension(const std::string& id,
27 base::FilePath* file_path,
28 std::string* version) OVERRIDE;
29 virtual void PutExtension(const std::string& id,
30 const base::FilePath& file_path,
31 const std::string& version,
32 const PutExtensionCallback& callback) OVERRIDE;
34 private:
35 typedef std::map<std::string, std::pair<std::string, base::FilePath> > Map;
36 // Set of extensions that can be cached.
37 std::set<std::string> allowed_extensions_;
39 // Map of know extensions.
40 Map cache_;
42 DISALLOW_COPY_AND_ASSIGN(ExtensionCacheFake);
45 } // namespace extensions
47 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_CACHE_FAKE_H_