| 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. | |
| 28 class PlatformAppBrowserTest : public ExtensionApiTest { | 22 class PlatformAppBrowserTest : public ExtensionApiTest { |
| 29 public: | 23 public: |
| 30 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 24 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
| 31 | 25 |
| 32 protected: | 26 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 | |
| 39 // Runs the app named |name| out of the platform_apps subdirectory. Waits | 27 // Runs the app named |name| out of the platform_apps subdirectory. Waits |
| 40 // until it is launched. | 28 // until it is launched. |
| 41 const Extension* LoadAndLaunchPlatformApp(const char* name); | 29 const Extension* LoadAndLaunchPlatformApp(const char* name); |
| 42 | 30 |
| 43 // Installs and runs the app named |name| out of the platform_apps | 31 // Installs and runs the app named |name| out of the platform_apps |
| 44 // subdirectory. Waits until it is launched. | 32 // subdirectory. Waits until it is launched. |
| 45 const Extension* InstallAndLaunchPlatformApp(const char* name); | 33 const Extension* InstallAndLaunchPlatformApp(const char* name); |
| 46 | 34 |
| 47 // Gets the WebContents associated with the first shell window that is found | 35 // Gets the WebContents associated with the first shell window that is found |
| 48 // (most tests only deal with one platform app window, so this is good | 36 // (most tests only deal with one platform app window, so this is good |
| (...skipping 19 matching lines...) Expand all Loading... |
| 68 // The command line already has an argument on it - about:blank, which | 56 // The command line already has an argument on it - about:blank, which |
| 69 // is set by InProcessBrowserTest::PrepareTestCommandLine. For platform app | 57 // is set by InProcessBrowserTest::PrepareTestCommandLine. For platform app |
| 70 // launch tests we need to clear this. | 58 // launch tests we need to clear this. |
| 71 void ClearCommandLineArgs(); | 59 void ClearCommandLineArgs(); |
| 72 | 60 |
| 73 // Sets up the command line for running platform apps. | 61 // Sets up the command line for running platform apps. |
| 74 void SetCommandLineArg(const std::string& test_file); | 62 void SetCommandLineArg(const std::string& test_file); |
| 75 | 63 |
| 76 // Creates an empty shell window for |extension|. | 64 // Creates an empty shell window for |extension|. |
| 77 ShellWindow* CreateShellWindow(const Extension* extension); | 65 ShellWindow* CreateShellWindow(const Extension* extension); |
| 66 |
| 67 // Closes |window| and waits until it's gone. |
| 68 void CloseShellWindow(ShellWindow* window); |
| 78 }; | 69 }; |
| 79 | 70 |
| 80 } | 71 } |
| 81 | 72 |
| 82 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ | 73 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ |
| OLD | NEW |