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 |
28 // The runner of WebUI javascript based tests. | 34 // The runner of WebUI javascript based tests. |
29 // See chrome/test/data/webui/test_api.js for the javascript side test API's. | 35 // See chrome/test/data/webui/test_api.js for the javascript side test API's. |
30 // | 36 // |
31 // These tests should follow the form given in: | 37 // These tests should follow the form given in: |
32 // chrome/test/data/webui/sample_downloads.js. | 38 // chrome/test/data/webui/sample_downloads.js. |
33 // and the lone test within this class. | 39 // and the lone test within this class. |
34 class WebUIBrowserTest : public JavaScriptBrowserTest { | 40 class WebUIBrowserTest : public JavaScriptBrowserTest { |
35 public: | 41 public: |
36 ~WebUIBrowserTest() override; | 42 ~WebUIBrowserTest() override; |
37 | 43 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 std::string preload_test_name_; | 155 std::string preload_test_name_; |
150 | 156 |
151 // When this is non-NULL, this is The WebUI instance used for testing. | 157 // When this is non-NULL, this is The WebUI instance used for testing. |
152 // Otherwise the selected tab's web_ui is used. | 158 // Otherwise the selected tab's web_ui is used. |
153 content::WebUI* override_selected_web_ui_; | 159 content::WebUI* override_selected_web_ui_; |
154 | 160 |
155 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; | 161 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_; |
156 }; | 162 }; |
157 | 163 |
158 #endif // CHROME_TEST_BASE_WEB_UI_BROWSER_TEST_H_ | 164 #endif // CHROME_TEST_BASE_WEB_UI_BROWSER_TEST_H_ |
OLD | NEW |