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_TEST_BASE_WEB_UI_BROWSERTEST_H_ | 5 #ifndef CHROME_TEST_BASE_WEB_UI_BROWSERTEST_H_ |
6 #define CHROME_TEST_BASE_WEB_UI_BROWSERTEST_H_ | 6 #define CHROME_TEST_BASE_WEB_UI_BROWSERTEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 // Returns a mock WebUI object under test (if any). | 132 // Returns a mock WebUI object under test (if any). |
133 virtual content::WebUIMessageHandler* GetMockMessageHandler(); | 133 virtual content::WebUIMessageHandler* GetMockMessageHandler(); |
134 | 134 |
135 // Returns a file:// GURL constructed from |path| inside the test data dir for | 135 // Returns a file:// GURL constructed from |path| inside the test data dir for |
136 // webui tests. | 136 // webui tests. |
137 static GURL WebUITestDataPathToURL(const base::FilePath::StringType& path); | 137 static GURL WebUITestDataPathToURL(const base::FilePath::StringType& path); |
138 | 138 |
139 private: | 139 private: |
140 // Builds a string containing all added javascript libraries. | 140 // Builds a string containing all added javascript libraries. |
141 void BuildJavascriptLibraries(string16* content); | 141 void BuildJavascriptLibraries(base::string16* content); |
142 | 142 |
143 // Builds a string with a call to the runTest JS function, passing the | 143 // Builds a string with a call to the runTest JS function, passing the |
144 // given |is_async|, |test_name| and its |args|. | 144 // given |is_async|, |test_name| and its |args|. |
145 string16 BuildRunTestJSCall(bool is_async, | 145 base::string16 BuildRunTestJSCall( |
146 const std::string& test_name, | 146 bool is_async, |
147 const WebUIBrowserTest::ConstValueVector& args); | 147 const std::string& test_name, |
| 148 const WebUIBrowserTest::ConstValueVector& args); |
148 | 149 |
149 // Loads all libraries added with AddLibrary(), and calls |function_name| with | 150 // Loads all libraries added with AddLibrary(), and calls |function_name| with |
150 // |function_arguments|. When |is_test| is true, the framework wraps | 151 // |function_arguments|. When |is_test| is true, the framework wraps |
151 // |function_name| with a test helper function, which waits for completion, | 152 // |function_name| with a test helper function, which waits for completion, |
152 // logging an error message on failure, otherwise |function_name| is called | 153 // logging an error message on failure, otherwise |function_name| is called |
153 // asynchronously. When |preload_host| is non-NULL, sends the javascript to | 154 // asynchronously. When |preload_host| is non-NULL, sends the javascript to |
154 // the RenderView for evaluation at the appropriate time before the onload | 155 // the RenderView for evaluation at the appropriate time before the onload |
155 // call is made. Passes |is_async| along to runTest wrapper. | 156 // call is made. Passes |is_async| along to runTest wrapper. |
156 bool RunJavascriptUsingHandler(const std::string& function_name, | 157 bool RunJavascriptUsingHandler(const std::string& function_name, |
157 const ConstValueVector& function_arguments, | 158 const ConstValueVector& function_arguments, |
(...skipping 26 matching lines...) Expand all Loading... |
184 std::string preload_test_name_; | 185 std::string preload_test_name_; |
185 | 186 |
186 // When this is non-NULL, this is The WebUI instance used for testing. | 187 // When this is non-NULL, this is The WebUI instance used for testing. |
187 // Otherwise the selected tab's web_ui is used. | 188 // Otherwise the selected tab's web_ui is used. |
188 content::WebUI* override_selected_web_ui_; | 189 content::WebUI* override_selected_web_ui_; |
189 | 190 |
190 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; | 191 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; |
191 }; | 192 }; |
192 | 193 |
193 #endif // CHROME_TEST_BASE_WEB_UI_BROWSERTEST_H_ | 194 #endif // CHROME_TEST_BASE_WEB_UI_BROWSERTEST_H_ |
OLD | NEW |