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

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

Issue 2801583003: developerPrivate.repair: Skip not-corrupted and policy extensions (Closed)
Patch Set: adress comments 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
lazyboy 2017/04/06 22:32:56 Moved test mock to this new file.
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_MOCK_EXTERNAL_PROVIDER_H_
6 #define CHROME_BROWSER_EXTENSIONS_MOCK_EXTERNAL_PROVIDER_H_
7
Devlin 2017/04/07 16:10:04 #include <map> #include <memory> #include <string>
lazyboy 2017/04/07 17:30:27 Done.
8 #include "base/files/file_path.h"
9 #include "extensions/browser/external_provider_interface.h"
10 #include "extensions/common/extension_id.h"
11 #include "extensions/common/manifest.h"
12
13 namespace extensions {
14
15 class MockExternalProvider : public extensions::ExternalProviderInterface {
Devlin 2017/04/07 16:10:04 nit: no extensions:: prefix.
lazyboy 2017/04/07 17:30:27 Done.
16 public:
17 MockExternalProvider(VisitorInterface* visitor, Manifest::Location location);
18 ~MockExternalProvider() override;
19
20 void UpdateOrAddExtension(const ExtensionId& id,
21 const std::string& version,
22 const base::FilePath& path);
23
24 void RemoveExtension(const ExtensionId& id);
25
26 // ExternalProviderInterface implementation:
27 void VisitRegisteredExtension() override;
28 bool HasExtension(const std::string& id) const override;
29 bool GetExtensionDetails(
30 const std::string& id,
31 Manifest::Location* location,
32 std::unique_ptr<base::Version>* version) const override;
Devlin 2017/04/07 16:10:04 forward declare version
lazyboy 2017/04/07 17:30:27 Done.
33 bool IsReady() const override;
34 void ServiceShutdown() override {}
35
36 int visit_count() const { return visit_count_; }
37 void set_visit_count(int visit_count) { visit_count_ = visit_count; }
38
39 private:
40 using DataMap = std::map<ExtensionId, std::pair<std::string, base::FilePath>>;
41 DataMap extension_map_;
42 Manifest::Location location_;
43 VisitorInterface* visitor_;
44
45 // visit_count_ tracks the number of calls to VisitRegisteredExtension().
46 // Mutable because it must be incremented on each call to
47 // VisitRegisteredExtension(), which must be a const method to inherit
48 // from the class being mocked.
49 mutable int visit_count_;
50
51 private:
Devlin 2017/04/07 16:10:04 delete this line (private scope started on line 39
lazyboy 2017/04/07 17:30:27 Done.
52 DISALLOW_COPY_AND_ASSIGN(MockExternalProvider);
53 };
54
55 } // namespace extensions
56
57 #endif // CHROME_BROWSER_EXTENSIONS_MOCK_EXTERNAL_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698