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_EXTENSION_APITEST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 const std::string& page_url); | 107 const std::string& page_url); |
108 | 108 |
109 // Same as RunExtensionSubtestIncognito, but disables file access. | 109 // Same as RunExtensionSubtestIncognito, but disables file access. |
110 bool RunExtensionSubtestIncognitoNoFileAccess(const char* extension_name, | 110 bool RunExtensionSubtestIncognitoNoFileAccess(const char* extension_name, |
111 const std::string& page_url); | 111 const std::string& page_url); |
112 | 112 |
113 // Load |page_url| and wait for pass / fail notification from the extension | 113 // Load |page_url| and wait for pass / fail notification from the extension |
114 // API on the page. | 114 // API on the page. |
115 bool RunPageTest(const std::string& page_url); | 115 bool RunPageTest(const std::string& page_url); |
116 | 116 |
| 117 // Similar to RunExtensionTest, except used for running tests in platform app |
| 118 // shell windows. |
| 119 bool RunPlatformAppTest(const char* extension_name); |
| 120 |
117 // Start the test server, and store details of its state. Those details | 121 // Start the test server, and store details of its state. Those details |
118 // will be available to javascript tests using chrome.test.getConfig(). | 122 // will be available to javascript tests using chrome.test.getConfig(). |
119 bool StartTestServer(); | 123 bool StartTestServer(); |
120 | 124 |
121 // Test that exactly one extension loaded. If so, return a pointer to | 125 // Test that exactly one extension loaded. If so, return a pointer to |
122 // the extension. If not, return NULL and set message_. | 126 // the extension. If not, return NULL and set message_. |
123 const Extension* GetSingleLoadedExtension(); | 127 const Extension* GetSingleLoadedExtension(); |
124 | 128 |
125 // All extensions tested by ExtensionApiTest are in the "api_test" dir. | 129 // All extensions tested by ExtensionApiTest are in the "api_test" dir. |
126 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 130 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
127 | 131 |
128 // If it failed, what was the error message? | 132 // If it failed, what was the error message? |
129 std::string message_; | 133 std::string message_; |
130 | 134 |
131 private: | 135 private: |
| 136 enum Flags { |
| 137 kFlagNone = 0, |
| 138 kFlagEnableIncognito = 1 << 0, |
| 139 kFlagEnableFileAccess = 1 << 1, |
| 140 kFlagLoadAsComponent = 1 << 2, |
| 141 kFlagLaunchAppShell = 1 << 3 |
| 142 }; |
132 bool RunExtensionTestImpl(const char* extension_name, | 143 bool RunExtensionTestImpl(const char* extension_name, |
133 const std::string& test_page, | 144 const std::string& test_page, |
134 bool enable_incognito, | 145 int flags); |
135 bool enable_fileaccess, | |
136 bool load_as_component); | |
137 | 146 |
138 // Hold details of the test, set in C++, which can be accessed by | 147 // Hold details of the test, set in C++, which can be accessed by |
139 // javascript using chrome.test.getConfig(). | 148 // javascript using chrome.test.getConfig(). |
140 scoped_ptr<DictionaryValue> test_config_; | 149 scoped_ptr<DictionaryValue> test_config_; |
141 }; | 150 }; |
142 | 151 |
143 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ | 152 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ |
OLD | NEW |