OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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. | |
4 | |
5 #ifndef CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ | |
7 | |
8 | |
9 #include "apps/shell_window.h" | |
10 #include "chrome/browser/extensions/extension_apitest.h" | |
11 | |
12 namespace content { | |
13 class WebContents; | |
14 } | |
15 | |
16 class CommandLine; | |
17 | |
18 namespace extensions { | |
19 class Extension; | |
20 | |
21 class PlatformAppBrowserTest : public ExtensionApiTest { | |
22 public: | |
23 PlatformAppBrowserTest(); | |
24 | |
25 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
26 | |
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); | |
31 | |
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); | |
35 | |
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(); | |
40 | |
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(); | |
44 | |
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); | |
48 | |
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); | |
53 | |
54 // Returns the number of shell windows. | |
55 size_t GetShellWindowCount(); | |
56 | |
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(); | |
61 | |
62 // Sets up the command line for running platform apps. | |
63 void SetCommandLineArg(const std::string& test_file); | |
64 | |
65 // Creates an empty shell window for |extension|. | |
66 apps::ShellWindow* CreateShellWindow(const Extension* extension); | |
67 | |
68 apps::ShellWindow* CreateShellWindowFromParams( | |
69 const Extension* extension, | |
70 const apps::ShellWindow::CreateParams& params); | |
71 | |
72 // Closes |window| and waits until it's gone. | |
73 void CloseShellWindow(apps::ShellWindow* window); | |
74 | |
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); | |
83 }; | |
84 | |
85 class ExperimentalPlatformAppBrowserTest : public PlatformAppBrowserTest { | |
86 public: | |
87 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | |
88 }; | |
89 | |
90 } // namespace extensions | |
91 | |
92 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ | |
OLD | NEW |