OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_TEST_H_ | 5 #ifndef CHROME_TEST_BASE_WEB_UI_BROWSER_TEST_H_ |
6 #define CHROME_TEST_BASE_WEB_UI_BROWSER_TEST_H_ | 6 #define CHROME_TEST_BASE_WEB_UI_BROWSER_TEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "chrome/test/base/javascript_browser_test.h" | 13 #include "chrome/test/base/javascript_browser_test.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class Value; | 16 class Value; |
17 } | 17 } |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 class RenderViewHost; | 20 class RenderViewHost; |
21 class WebUI; | 21 class WebUI; |
22 class WebUIMessageHandler; | 22 class WebUIMessageHandler; |
23 } | 23 } |
24 | 24 |
25 class TestChromeWebUIControllerFactory; | 25 class TestChromeWebUIControllerFactory; |
26 class WebUITestHandler; | 26 class WebUITestHandler; |
27 | 27 |
28 // This macro simplifies the declaration of simple javascript unit tests. | |
29 // Use: | |
30 // WEB_UI_UNITTEST_F(MyWebUIPageTest, myJavascriptUnittest); | |
31 #define WEB_UI_UNITTEST_F(x, y) \ | |
32 IN_PROC_BROWSER_TEST_F(x, y) { ASSERT_TRUE(RunJavascriptTest(#y)); } | |
33 | |
34 // The runner of WebUI javascript based tests. | 28 // The runner of WebUI javascript based tests. |
35 // See chrome/test/data/webui/test_api.js for the javascript side test API's. | 29 // See chrome/test/data/webui/test_api.js for the javascript side test API's. |
36 // | 30 // |
37 // These tests should follow the form given in: | 31 // These tests should follow the form given in: |
38 // chrome/test/data/webui/sample_downloads.js. | 32 // chrome/test/data/webui/sample_downloads.js. |
39 // and the lone test within this class. | 33 // and the lone test within this class. |
40 class WebUIBrowserTest : public JavaScriptBrowserTest { | 34 class WebUIBrowserTest : public JavaScriptBrowserTest { |
41 public: | 35 public: |
42 ~WebUIBrowserTest() override; | 36 ~WebUIBrowserTest() override; |
43 | 37 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 std::string preload_test_name_; | 149 std::string preload_test_name_; |
156 | 150 |
157 // When this is non-NULL, this is The WebUI instance used for testing. | 151 // When this is non-NULL, this is The WebUI instance used for testing. |
158 // Otherwise the selected tab's web_ui is used. | 152 // Otherwise the selected tab's web_ui is used. |
159 content::WebUI* override_selected_web_ui_; | 153 content::WebUI* override_selected_web_ui_; |
160 | 154 |
161 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; | 155 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; |
162 }; | 156 }; |
163 | 157 |
164 #endif // CHROME_TEST_BASE_WEB_UI_BROWSER_TEST_H_ | 158 #endif // CHROME_TEST_BASE_WEB_UI_BROWSER_TEST_H_ |
OLD | NEW |