Prevent chrome://net-internals/#export from flickering
[chromium-blink-merge.git] / chrome / browser / extensions / extension_action_test_util.h
blobddad3a44a650e191ba602ec0ba4908e7277c1d13
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"
13 class Profile;
15 namespace content {
16 class WebContents;
19 namespace extensions {
20 class Extension;
21 class ExtensionToolbarModel;
23 namespace extension_action_test_util {
25 // The different possible types of actions for an extension to have (we use
26 // this instead of ActionInfo::Type because we want a "none" option).
27 enum ActionType {
28 NO_ACTION,
29 PAGE_ACTION,
30 BROWSER_ACTION
33 // TODO(devlin): Should we also pull out methods to test browser actions?
35 // Returns the number of page actions that are visible in the given
36 // |web_contents|.
37 size_t GetVisiblePageActionCount(content::WebContents* web_contents);
39 // Returns the total number of page actions (visible or not) for the given
40 // |web_contents|.
41 size_t GetTotalPageActionCount(content::WebContents* web_contents);
43 // Creates and returns an extension with the given |name| with the given
44 // |action_type|.
45 // Does not add the extension to the extension service or registry.
46 scoped_refptr<const Extension> CreateActionExtension(const std::string& name,
47 ActionType action_type);
49 // Creates a new ExtensionToolbarModel for the given |profile|, and associates
50 // it with the profile as a keyed service.
51 // This should only be used in unit tests (since it assumes the existence of
52 // a TestExtensionSystem), but if running a browser test, the model should
53 // already be created.
54 ExtensionToolbarModel* CreateToolbarModelForProfile(Profile* profile);
55 // Like above, but doesn't run the ExtensionSystem::ready() task for the new
56 // model.
57 ExtensionToolbarModel* CreateToolbarModelForProfileWithoutWaitingForReady(
58 Profile* profile);
60 } // namespace extension_action_test_util
61 } // namespace extensions
63 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_TEST_UTIL_H_