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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/mock_external_provider.h
diff --git a/extensions/browser/mock_external_provider.h b/extensions/browser/mock_external_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..0dc6e8b99e11460c95b714bdc9ef4fb591715e6b
--- /dev/null
+++ b/extensions/browser/mock_external_provider.h
@@ -0,0 +1,57 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
lazyboy 2017/04/06 22:32:56 Moved test mock to this new file.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_MOCK_EXTERNAL_PROVIDER_H_
+#define CHROME_BROWSER_EXTENSIONS_MOCK_EXTERNAL_PROVIDER_H_
+
Devlin 2017/04/07 16:10:04 #include <map> #include <memory> #include <string>
lazyboy 2017/04/07 17:30:27 Done.
+#include "base/files/file_path.h"
+#include "extensions/browser/external_provider_interface.h"
+#include "extensions/common/extension_id.h"
+#include "extensions/common/manifest.h"
+
+namespace extensions {
+
+class MockExternalProvider : public extensions::ExternalProviderInterface {
Devlin 2017/04/07 16:10:04 nit: no extensions:: prefix.
lazyboy 2017/04/07 17:30:27 Done.
+ public:
+ MockExternalProvider(VisitorInterface* visitor, Manifest::Location location);
+ ~MockExternalProvider() override;
+
+ void UpdateOrAddExtension(const ExtensionId& id,
+ const std::string& version,
+ const base::FilePath& path);
+
+ void RemoveExtension(const ExtensionId& id);
+
+ // ExternalProviderInterface implementation:
+ void VisitRegisteredExtension() override;
+ bool HasExtension(const std::string& id) const override;
+ bool GetExtensionDetails(
+ const std::string& id,
+ Manifest::Location* location,
+ 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.
+ bool IsReady() const override;
+ void ServiceShutdown() override {}
+
+ int visit_count() const { return visit_count_; }
+ void set_visit_count(int visit_count) { visit_count_ = visit_count; }
+
+ private:
+ using DataMap = std::map<ExtensionId, std::pair<std::string, base::FilePath>>;
+ DataMap extension_map_;
+ Manifest::Location location_;
+ VisitorInterface* visitor_;
+
+ // visit_count_ tracks the number of calls to VisitRegisteredExtension().
+ // Mutable because it must be incremented on each call to
+ // VisitRegisteredExtension(), which must be a const method to inherit
+ // from the class being mocked.
+ mutable int visit_count_;
+
+ 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.
+ DISALLOW_COPY_AND_ASSIGN(MockExternalProvider);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_MOCK_EXTERNAL_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698