Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / extensions / extension_action_test_util.h
blob0d527269abb924a46b18288de062320258f60a5e
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_EXTENSION_ACTION_TEST_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_TEST_UTIL_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "extensions/common/manifest.h"
14 class Profile;
16 namespace content {
17 class WebContents;
20 namespace extensions {
21 class Extension;
22 class ExtensionToolbarModel;
24 namespace extension_action_test_util {
26 // The different possible types of actions for an extension to have (we use
27 // this instead of ActionInfo::Type because we want a "none" option).
28 enum ActionType {
29 NO_ACTION,
30 PAGE_ACTION,
31 BROWSER_ACTION
34 // TODO(devlin): Should we also pull out methods to test browser actions?
36 // Returns the number of page actions that are visible in the given
37 // |web_contents|.
38 size_t GetVisiblePageActionCount(content::WebContents* web_contents);
40 // Returns the total number of page actions (visible or not) for the given
41 // |web_contents|.
42 size_t GetTotalPageActionCount(content::WebContents* web_contents);
44 // Creates and returns an extension with the given |name| with the given
45 // |action_type|.
46 // Does not add the extension to the extension service or registry.
47 scoped_refptr<const Extension> CreateActionExtension(const std::string& name,
48 ActionType action_type);
49 scoped_refptr<const Extension> CreateActionExtension(
50 const std::string& name,
51 ActionType action_type,
52 Manifest::Location location);
54 // Creates a new ExtensionToolbarModel for the given |profile|, and associates
55 // it with the profile as a keyed service.
56 // This should only be used in unit tests (since it assumes the existence of
57 // a TestExtensionSystem), but if running a browser test, the model should
58 // already be created.
59 ExtensionToolbarModel* CreateToolbarModelForProfile(Profile* profile);
60 // Like above, but doesn't run the ExtensionSystem::ready() task for the new
61 // model.
62 ExtensionToolbarModel* CreateToolbarModelForProfileWithoutWaitingForReady(
63 Profile* profile);
65 } // namespace extension_action_test_util
66 } // namespace extensions
68 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_TEST_UTIL_H_