Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: extensions/browser/mock_external_provider.h

Issue 2801583003: developerPrivate.repair: Skip not-corrupted and policy extensions (Closed)
Patch Set: fix WebstoreReinsallerBrowserTest Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/content_verifier.cc ('k') | extensions/browser/mock_external_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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 EXTENSIONS_BROWSER_MOCK_EXTERNAL_PROVIDER_H_
6 #define EXTENSIONS_BROWSER_MOCK_EXTERNAL_PROVIDER_H_
7
8 #include <map>
9 #include <memory>
10 #include <string>
11 #include <utility>
12
13 #include "base/files/file_path.h"
14 #include "base/macros.h"
15 #include "extensions/browser/external_provider_interface.h"
16 #include "extensions/common/extension_id.h"
17 #include "extensions/common/manifest.h"
18
19 namespace base {
20 class Version;
21 }
22
23 namespace extensions {
24
25 class MockExternalProvider : public ExternalProviderInterface {
26 public:
27 MockExternalProvider(VisitorInterface* visitor, Manifest::Location location);
28 ~MockExternalProvider() override;
29
30 void UpdateOrAddExtension(const ExtensionId& id,
31 const std::string& version,
32 const base::FilePath& path);
33
34 void RemoveExtension(const ExtensionId& id);
35
36 // ExternalProviderInterface implementation:
37 void VisitRegisteredExtension() override;
38 bool HasExtension(const std::string& id) const override;
39 bool GetExtensionDetails(
40 const std::string& id,
41 Manifest::Location* location,
42 std::unique_ptr<base::Version>* version) const override;
43 bool IsReady() const override;
44 void ServiceShutdown() override {}
45
46 int visit_count() const { return visit_count_; }
47 void set_visit_count(int visit_count) { visit_count_ = visit_count; }
48
49 private:
50 using DataMap = std::map<ExtensionId, std::pair<std::string, base::FilePath>>;
51 DataMap extension_map_;
52 Manifest::Location location_;
53 VisitorInterface* visitor_;
54
55 // visit_count_ tracks the number of calls to VisitRegisteredExtension().
56 // Mutable because it must be incremented on each call to
57 // VisitRegisteredExtension(), which must be a const method to inherit
58 // from the class being mocked.
59 mutable int visit_count_;
60
61 DISALLOW_COPY_AND_ASSIGN(MockExternalProvider);
62 };
63
64 } // namespace extensions
65
66 #endif // EXTENSIONS_BROWSER_MOCK_EXTERNAL_PROVIDER_H_
OLDNEW
« no previous file with comments | « extensions/browser/content_verifier.cc ('k') | extensions/browser/mock_external_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698