Files.app: Dispatch 'drive-connection-changed' event on initialization of VolumeManag...
[chromium-blink-merge.git] / extensions / test / test_extensions_client.h
blob209a08ad551dbe44c3748a57ff99c2b0bce54ca1
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 EXTENSIONS_TEST_TEST_EXTENSIONS_CLIENT_H_
6 #define EXTENSIONS_TEST_TEST_EXTENSIONS_CLIENT_H_
8 #include "base/macros.h"
9 #include "extensions/common/extensions_client.h"
11 namespace extensions {
13 class TestExtensionsClient : public ExtensionsClient {
14 public:
15 // An interface that lets tests change the set of image paths before they are
16 // returned by TestExtensionClient::GetBrowserImagePaths.
17 class BrowserImagePathsFilter {
18 public:
19 virtual void Filter(const Extension* extension,
20 std::set<base::FilePath>* paths) = 0;
23 TestExtensionsClient();
24 ~TestExtensionsClient() override;
26 void AddBrowserImagePathsFilter(BrowserImagePathsFilter* filter);
27 void RemoveBrowserImagePathsFilter(BrowserImagePathsFilter* filter);
29 private:
30 void Initialize() override;
31 const PermissionMessageProvider& GetPermissionMessageProvider()
32 const override;
33 const std::string GetProductName() override;
34 scoped_ptr<FeatureProvider> CreateFeatureProvider(
35 const std::string& name) const override;
36 scoped_ptr<JSONFeatureProviderSource> CreateFeatureProviderSource(
37 const std::string& name) const override;
38 void FilterHostPermissions(
39 const URLPatternSet& hosts,
40 URLPatternSet* new_hosts,
41 std::set<PermissionMessage>* messages) const override;
42 void FilterHostPermissions(const URLPatternSet& hosts,
43 URLPatternSet* new_hosts,
44 PermissionIDSet* permissions) const override;
45 void SetScriptingWhitelist(const ScriptingWhitelist& whitelist) override;
46 const ScriptingWhitelist& GetScriptingWhitelist() const override;
47 URLPatternSet GetPermittedChromeSchemeHosts(
48 const Extension* extension,
49 const APIPermissionSet& api_permissions) const override;
50 bool IsScriptableURL(const GURL& url, std::string* error) const override;
51 bool IsAPISchemaGenerated(const std::string& name) const override;
52 base::StringPiece GetAPISchema(const std::string& name) const override;
53 void RegisterAPISchemaResources(ExtensionAPI* api) const override;
54 bool ShouldSuppressFatalErrors() const override;
55 void RecordDidSuppressFatalError() override;
56 std::string GetWebstoreBaseURL() const override;
57 std::string GetWebstoreUpdateURL() const override;
58 bool IsBlacklistUpdateURL(const GURL& url) const override;
59 std::set<base::FilePath> GetBrowserImagePaths(
60 const Extension* extension) override;
62 // A whitelist of extensions that can script anywhere. Do not add to this
63 // list (except in tests) without consulting the Extensions team first.
64 // Note: Component extensions have this right implicitly and do not need to be
65 // added to this list.
66 ScriptingWhitelist scripting_whitelist_;
68 std::set<BrowserImagePathsFilter*> browser_image_filters_;
70 DISALLOW_COPY_AND_ASSIGN(TestExtensionsClient);
73 } // namespace extensions
75 #endif // EXTENSIONS_TEST_TEST_EXTENSIONS_CLIENT_H_