| 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 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // Allow manifest versions older that Extension::kModernManifestVersion. | 58 // Allow manifest versions older that Extension::kModernManifestVersion. |
| 59 // Used to test old manifest features. | 59 // Used to test old manifest features. |
| 60 kFlagAllowOldManifestVersions = 1 << 6, | 60 kFlagAllowOldManifestVersions = 1 << 6, |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 ExtensionApiTest(); | 63 ExtensionApiTest(); |
| 64 virtual ~ExtensionApiTest(); | 64 virtual ~ExtensionApiTest(); |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 // InProcessBrowserTest: | 67 // InProcessBrowserTest: |
| 68 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | 68 virtual void SetUpInProcessBrowserTestFixture() override; |
| 69 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; | 69 virtual void TearDownInProcessBrowserTestFixture() override; |
| 70 | 70 |
| 71 // Load |extension_name| and wait for pass / fail notification. | 71 // Load |extension_name| and wait for pass / fail notification. |
| 72 // |extension_name| is a directory in "test/data/extensions/api_test". | 72 // |extension_name| is a directory in "test/data/extensions/api_test". |
| 73 bool RunExtensionTest(const std::string& extension_name); | 73 bool RunExtensionTest(const std::string& extension_name); |
| 74 | 74 |
| 75 // Same as RunExtensionTest, but enables the extension for incognito mode. | 75 // Same as RunExtensionTest, but enables the extension for incognito mode. |
| 76 bool RunExtensionTestIncognito(const std::string& extension_name); | 76 bool RunExtensionTestIncognito(const std::string& extension_name); |
| 77 | 77 |
| 78 // Same as RunExtensionTest, but ignores any warnings in the manifest. | 78 // Same as RunExtensionTest, but ignores any warnings in the manifest. |
| 79 bool RunExtensionTestIgnoreManifestWarnings( | 79 bool RunExtensionTestIgnoreManifestWarnings( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Start the spawned test server, and store details of its state. Those | 142 // Start the spawned test server, and store details of its state. Those |
| 143 // details will be available to javascript tests using | 143 // details will be available to javascript tests using |
| 144 // chrome.test.getConfig(). | 144 // chrome.test.getConfig(). |
| 145 bool StartSpawnedTestServer(); | 145 bool StartSpawnedTestServer(); |
| 146 | 146 |
| 147 // Test that exactly one extension loaded. If so, return a pointer to | 147 // Test that exactly one extension loaded. If so, return a pointer to |
| 148 // the extension. If not, return NULL and set message_. | 148 // the extension. If not, return NULL and set message_. |
| 149 const extensions::Extension* GetSingleLoadedExtension(); | 149 const extensions::Extension* GetSingleLoadedExtension(); |
| 150 | 150 |
| 151 // All extensions tested by ExtensionApiTest are in the "api_test" dir. | 151 // All extensions tested by ExtensionApiTest are in the "api_test" dir. |
| 152 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; | 152 virtual void SetUpCommandLine(base::CommandLine* command_line) override; |
| 153 | 153 |
| 154 // If it failed, what was the error message? | 154 // If it failed, what was the error message? |
| 155 std::string message_; | 155 std::string message_; |
| 156 | 156 |
| 157 private: | 157 private: |
| 158 bool RunExtensionTestImpl(const std::string& extension_name, | 158 bool RunExtensionTestImpl(const std::string& extension_name, |
| 159 const std::string& test_page, | 159 const std::string& test_page, |
| 160 const char* custom_arg, | 160 const char* custom_arg, |
| 161 int flags); | 161 int flags); |
| 162 | 162 |
| 163 // Hold details of the test, set in C++, which can be accessed by | 163 // Hold details of the test, set in C++, which can be accessed by |
| 164 // javascript using chrome.test.getConfig(). | 164 // javascript using chrome.test.getConfig(). |
| 165 scoped_ptr<base::DictionaryValue> test_config_; | 165 scoped_ptr<base::DictionaryValue> test_config_; |
| 166 | 166 |
| 167 // Hold the test WebSocket server. | 167 // Hold the test WebSocket server. |
| 168 scoped_ptr<net::SpawnedTestServer> websocket_server_; | 168 scoped_ptr<net::SpawnedTestServer> websocket_server_; |
| 169 | 169 |
| 170 // Hold the test FTP server. | 170 // Hold the test FTP server. |
| 171 scoped_ptr<net::SpawnedTestServer> ftp_server_; | 171 scoped_ptr<net::SpawnedTestServer> ftp_server_; |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ | 174 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ |
| OLD | NEW |