OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // True if we're in a nested message loop waiting for results from | 63 // True if we're in a nested message loop waiting for results from |
64 // the extension. | 64 // the extension. |
65 bool waiting_; | 65 bool waiting_; |
66 }; | 66 }; |
67 | 67 |
68 // Load |extension_name| and wait for pass / fail notification. | 68 // Load |extension_name| and wait for pass / fail notification. |
69 // |extension_name| is a directory in "test/data/extensions/api_test". | 69 // |extension_name| is a directory in "test/data/extensions/api_test". |
70 bool RunExtensionTest(const char* extension_name); | 70 bool RunExtensionTest(const char* extension_name); |
71 | 71 |
72 // Load |extension_name|, load page at path |subtest_page| under the | 72 // If not empty, Load |extension_name|, load |page_url| and wait for pass / |
73 // extension, and wait for pass / fail notification. |extension_name| | 73 // fail notification from the extension API on the page. Note that if |
74 // is a directory in "test/data/extensions/api_test". | 74 // |page_url| is not a valid url, it will be treated as a resource within |
| 75 // the extension. |extension_name| is a directory in |
| 76 // "test/data/extensions/api_test". |
75 bool RunExtensionSubtest(const char* extension_name, | 77 bool RunExtensionSubtest(const char* extension_name, |
76 const std::string& subtest_page); | 78 const std::string& page_url); |
| 79 |
| 80 // Load |page_url| and wait for pass / fail notification from the extension |
| 81 // API on the page. |
| 82 bool RunPageTest(const std::string& page_url); |
77 | 83 |
78 // Test that exactly one extension loaded. If so, return a pointer to | 84 // Test that exactly one extension loaded. If so, return a pointer to |
79 // the extension. If not, return NULL and set message_. | 85 // the extension. If not, return NULL and set message_. |
80 Extension* GetSingleLoadedExtension(); | 86 Extension* GetSingleLoadedExtension(); |
81 | 87 |
82 // All extensions tested by ExtensionApiTest are in the "api_test" dir. | 88 // All extensions tested by ExtensionApiTest are in the "api_test" dir. |
83 virtual void SetUpCommandLine(CommandLine* command_line); | 89 virtual void SetUpCommandLine(CommandLine* command_line); |
84 | 90 |
85 // If it failed, what was the error message? | 91 // If it failed, what was the error message? |
86 std::string message_; | 92 std::string message_; |
87 | 93 |
88 private: | 94 private: |
89 bool RunExtensionTestImpl(const char* extension_name, | 95 bool RunExtensionTestImpl(const char* extension_name, |
90 const std::string& test_page); | 96 const std::string& test_page); |
91 }; | 97 }; |
92 | 98 |
93 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ | 99 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ |
OLD | NEW |