OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ |
7 | 7 |
8 | 8 |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 | 10 |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class WebContents; | 13 class WebContents; |
14 } | 14 } |
15 | 15 |
16 class CommandLine; | 16 class CommandLine; |
17 class ShellWindow; | 17 class ShellWindow; |
18 | 18 |
19 namespace extensions { | 19 namespace extensions { |
20 class Extension; | 20 class Extension; |
21 | 21 |
| 22 // TODO(benwells): Clean up this test hierarchy. |
| 23 // - rename this to PlatformAppApiTest |
| 24 // - remove the existing PlatformAppApiTest |
| 25 // - Move the CloseWindow* functions from ExtensionBrowserTest to here |
| 26 // - Move the RunPlatformAppTest functions from ExtensionApiTest to here |
| 27 // - Make all platform app tests use this class. |
22 class PlatformAppBrowserTest : public ExtensionApiTest { | 28 class PlatformAppBrowserTest : public ExtensionApiTest { |
23 public: | 29 public: |
24 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 30 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
25 | 31 |
26 protected: | 32 protected: |
| 33 // Loads the app named |name| out of the platform_apps subdirectory. |
| 34 const Extension* LoadPlatformApp(const char* name); |
| 35 |
| 36 // Installs the app named |name| out of the platform_apps subdirectory. |
| 37 const Extension* InstallPlatformApp(const char* name); |
| 38 |
27 // Runs the app named |name| out of the platform_apps subdirectory. Waits | 39 // Runs the app named |name| out of the platform_apps subdirectory. Waits |
28 // until it is launched. | 40 // until it is launched. |
29 const Extension* LoadAndLaunchPlatformApp(const char* name); | 41 const Extension* LoadAndLaunchPlatformApp(const char* name); |
30 | 42 |
31 // Installs and runs the app named |name| out of the platform_apps | 43 // Installs and runs the app named |name| out of the platform_apps |
32 // subdirectory. Waits until it is launched. | 44 // subdirectory. Waits until it is launched. |
33 const Extension* InstallAndLaunchPlatformApp(const char* name); | 45 const Extension* InstallAndLaunchPlatformApp(const char* name); |
34 | 46 |
35 // Gets the WebContents associated with the first shell window that is found | 47 // Gets the WebContents associated with the first shell window that is found |
36 // (most tests only deal with one platform app window, so this is good | 48 // (most tests only deal with one platform app window, so this is good |
(...skipping 19 matching lines...) Expand all Loading... |
56 // The command line already has an argument on it - about:blank, which | 68 // The command line already has an argument on it - about:blank, which |
57 // is set by InProcessBrowserTest::PrepareTestCommandLine. For platform app | 69 // is set by InProcessBrowserTest::PrepareTestCommandLine. For platform app |
58 // launch tests we need to clear this. | 70 // launch tests we need to clear this. |
59 void ClearCommandLineArgs(); | 71 void ClearCommandLineArgs(); |
60 | 72 |
61 // Sets up the command line for running platform apps. | 73 // Sets up the command line for running platform apps. |
62 void SetCommandLineArg(const std::string& test_file); | 74 void SetCommandLineArg(const std::string& test_file); |
63 | 75 |
64 // Creates an empty shell window for |extension|. | 76 // Creates an empty shell window for |extension|. |
65 ShellWindow* CreateShellWindow(const Extension* extension); | 77 ShellWindow* CreateShellWindow(const Extension* extension); |
66 | |
67 // Closes |window| and waits until it's gone. | |
68 void CloseShellWindow(ShellWindow* window); | |
69 }; | 78 }; |
70 | 79 |
71 } | 80 } |
72 | 81 |
73 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ | 82 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ |
OLD | NEW |