Add a minor text member to ui::MenuModel.
[chromium-blink-merge.git] / chrome / browser / apps / app_browsertest_util.h
blobaa4efcd158f2730b4615153a0125c404dbc81060
1 // Copyright 2013 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_APPS_APP_BROWSERTEST_UTIL_H_
6 #define CHROME_BROWSER_APPS_APP_BROWSERTEST_UTIL_H_
9 #include "apps/shell_window.h"
10 #include "chrome/browser/extensions/extension_apitest.h"
12 namespace content {
13 class WebContents;
16 class CommandLine;
18 namespace extensions {
19 class Extension;
21 class PlatformAppBrowserTest : public ExtensionApiTest {
22 public:
23 PlatformAppBrowserTest();
25 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
27 protected:
28 // Runs the app named |name| out of the platform_apps subdirectory. Waits
29 // until it is launched.
30 const Extension* LoadAndLaunchPlatformApp(const char* name);
32 // Installs and runs the app named |name| out of the platform_apps
33 // subdirectory. Waits until it is launched.
34 const Extension* InstallAndLaunchPlatformApp(const char* name);
36 // Gets the WebContents associated with the first shell window that is found
37 // (most tests only deal with one platform app window, so this is good
38 // enough).
39 content::WebContents* GetFirstShellWindowWebContents();
41 // Gets the first shell window that is found (most tests only deal with one
42 // platform app window, so this is good enough).
43 apps::ShellWindow* GetFirstShellWindow();
45 // Runs chrome.windows.getAll for the given extension and returns the number
46 // of windows that the function returns.
47 size_t RunGetWindowsFunctionForExtension(const Extension* extension);
49 // Runs chrome.windows.get(|window_id|) for the the given extension and
50 // returns whether or not a window was found.
51 bool RunGetWindowFunctionForExtension(int window_id,
52 const Extension* extension);
54 // Returns the number of shell windows.
55 size_t GetShellWindowCount();
57 // The command line already has an argument on it - about:blank, which
58 // is set by InProcessBrowserTest::PrepareTestCommandLine. For platform app
59 // launch tests we need to clear this.
60 void ClearCommandLineArgs();
62 // Sets up the command line for running platform apps.
63 void SetCommandLineArg(const std::string& test_file);
65 // Creates an empty shell window for |extension|.
66 apps::ShellWindow* CreateShellWindow(const Extension* extension);
68 apps::ShellWindow* CreateShellWindowFromParams(
69 const Extension* extension,
70 const apps::ShellWindow::CreateParams& params);
72 // Closes |window| and waits until it's gone.
73 void CloseShellWindow(apps::ShellWindow* window);
75 // Call AdjustBoundsToBeVisibleOnScreen of |window|.
76 void CallAdjustBoundsToBeVisibleOnScreenForShellWindow(
77 apps::ShellWindow* window,
78 const gfx::Rect& cached_bounds,
79 const gfx::Rect& cached_screen_bounds,
80 const gfx::Rect& current_screen_bounds,
81 const gfx::Size& minimum_size,
82 gfx::Rect* bounds);
85 class ExperimentalPlatformAppBrowserTest : public PlatformAppBrowserTest {
86 public:
87 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
90 } // namespace extensions
92 #endif // CHROME_BROWSER_APPS_APP_BROWSERTEST_UTIL_H_