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 class MockExternalUrlController : public content::WebContentsDelegate { |
| 23 public: |
| 24 MockExternalUrlController(); |
| 25 virtual ~MockExternalUrlController(); |
| 26 |
| 27 private: |
| 28 // content::WebContentsDelegate implementation. |
| 29 virtual content::WebContents* OpenURLFromTab( |
| 30 content::WebContents* source, |
| 31 const content::OpenURLParams& params) OVERRIDE; |
| 32 |
| 33 DISALLOW_COPY_AND_ASSIGN(MockExternalUrlController); |
| 34 }; |
| 35 |
22 class PlatformAppBrowserTest : public ExtensionApiTest { | 36 class PlatformAppBrowserTest : public ExtensionApiTest { |
23 public: | 37 public: |
| 38 PlatformAppBrowserTest(); |
| 39 virtual ~PlatformAppBrowserTest(); |
24 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 40 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
| 41 virtual void SetUpOnMainThread() OVERRIDE; |
25 | 42 |
26 protected: | 43 protected: |
27 // Runs the app named |name| out of the platform_apps subdirectory. Waits | 44 // Runs the app named |name| out of the platform_apps subdirectory. Waits |
28 // until it is launched. | 45 // until it is launched. |
29 const Extension* LoadAndLaunchPlatformApp(const char* name); | 46 const Extension* LoadAndLaunchPlatformApp(const char* name); |
30 | 47 |
31 // Installs and runs the app named |name| out of the platform_apps | 48 // Installs and runs the app named |name| out of the platform_apps |
32 // subdirectory. Waits until it is launched. | 49 // subdirectory. Waits until it is launched. |
33 const Extension* InstallAndLaunchPlatformApp(const char* name); | 50 const Extension* InstallAndLaunchPlatformApp(const char* name); |
34 | 51 |
(...skipping 24 matching lines...) Expand all Loading... |
59 void ClearCommandLineArgs(); | 76 void ClearCommandLineArgs(); |
60 | 77 |
61 // Sets up the command line for running platform apps. | 78 // Sets up the command line for running platform apps. |
62 void SetCommandLineArg(const std::string& test_file); | 79 void SetCommandLineArg(const std::string& test_file); |
63 | 80 |
64 // Creates an empty shell window for |extension|. | 81 // Creates an empty shell window for |extension|. |
65 ShellWindow* CreateShellWindow(const Extension* extension); | 82 ShellWindow* CreateShellWindow(const Extension* extension); |
66 | 83 |
67 // Closes |window| and waits until it's gone. | 84 // Closes |window| and waits until it's gone. |
68 void CloseShellWindow(ShellWindow* window); | 85 void CloseShellWindow(ShellWindow* window); |
| 86 |
| 87 scoped_ptr<MockExternalUrlController> mock_external_url_controller_; |
69 }; | 88 }; |
70 | 89 |
71 } | 90 } |
72 | 91 |
73 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ | 92 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_BROWSERTEST_UTIL_H_ |
OLD | NEW |