OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_WEBUI_WEB_UI_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 bool RunJavascriptTest(const std::string& test_name); | 69 bool RunJavascriptTest(const std::string& test_name); |
70 bool RunJavascriptTest(const std::string& test_name, | 70 bool RunJavascriptTest(const std::string& test_name, |
71 base::Value* arg); | 71 base::Value* arg); |
72 bool RunJavascriptTest(const std::string& test_name, | 72 bool RunJavascriptTest(const std::string& test_name, |
73 base::Value* arg1, | 73 base::Value* arg1, |
74 base::Value* arg2); | 74 base::Value* arg2); |
75 bool RunJavascriptTest(const std::string& test_name, | 75 bool RunJavascriptTest(const std::string& test_name, |
76 const ConstValueVector& test_arguments); | 76 const ConstValueVector& test_arguments); |
77 | 77 |
78 // Runs a test that may include calls to functions in test_api.js, and waits | 78 // Runs a test that may include calls to functions in test_api.js, and waits |
79 // for call to asyncTestDone(). Takes ownership of Value arguments. | 79 // for call to testDone(). Takes ownership of Value arguments. |
80 bool RunJavascriptAsyncTest(const std::string& test_name); | 80 bool RunJavascriptAsyncTest(const std::string& test_name); |
81 bool RunJavascriptAsyncTest(const std::string& test_name, | 81 bool RunJavascriptAsyncTest(const std::string& test_name, |
82 base::Value* arg); | 82 base::Value* arg); |
83 bool RunJavascriptAsyncTest(const std::string& test_name, | 83 bool RunJavascriptAsyncTest(const std::string& test_name, |
84 base::Value* arg1, | 84 base::Value* arg1, |
85 base::Value* arg2); | 85 base::Value* arg2); |
86 bool RunJavascriptAsyncTest(const std::string& test_name, | 86 bool RunJavascriptAsyncTest(const std::string& test_name, |
87 base::Value* arg1, | 87 base::Value* arg1, |
88 base::Value* arg2, | 88 base::Value* arg2, |
89 base::Value* arg3); | 89 base::Value* arg3); |
(...skipping 28 matching lines...) Expand all Loading... |
118 static const char kDummyURL[]; | 118 static const char kDummyURL[]; |
119 | 119 |
120 WebUIBrowserTest(); | 120 WebUIBrowserTest(); |
121 | 121 |
122 // Set up test path & override for |kDummyURL|. | 122 // Set up test path & override for |kDummyURL|. |
123 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | 123 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
124 | 124 |
125 // Tear down override for |kDummyURL|. | 125 // Tear down override for |kDummyURL|. |
126 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; | 126 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; |
127 | 127 |
| 128 // Set a WebUI instance to run tests on. |
| 129 virtual void SetWebUIInstance(WebUI* web_ui); |
| 130 |
128 // Returns a mock WebUI object under test (if any). | 131 // Returns a mock WebUI object under test (if any). |
129 virtual WebUIMessageHandler* GetMockMessageHandler(); | 132 virtual WebUIMessageHandler* GetMockMessageHandler(); |
130 | 133 |
131 // Returns a file:// GURL constructed from |path| inside the test data dir for | 134 // Returns a file:// GURL constructed from |path| inside the test data dir for |
132 // webui tests. | 135 // webui tests. |
133 static GURL WebUITestDataPathToURL(const FilePath::StringType& path); | 136 static GURL WebUITestDataPathToURL(const FilePath::StringType& path); |
134 | 137 |
135 private: | 138 private: |
136 // TestNavigationObserver::JsInjectionReadyObserver implementation. | 139 // TestNavigationObserver::JsInjectionReadyObserver implementation. |
137 virtual void OnJsInjectionReady(RenderViewHost* render_view_host) OVERRIDE; | 140 virtual void OnJsInjectionReady(RenderViewHost* render_view_host) OVERRIDE; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 std::vector<FilePath> user_libraries_; | 174 std::vector<FilePath> user_libraries_; |
172 | 175 |
173 // Indicates that the libraries have been pre-loaded and to not load them | 176 // Indicates that the libraries have been pre-loaded and to not load them |
174 // again. | 177 // again. |
175 bool libraries_preloaded_; | 178 bool libraries_preloaded_; |
176 | 179 |
177 // Saves the states of |test_fixture| and |test_name| for calling | 180 // Saves the states of |test_fixture| and |test_name| for calling |
178 // PreloadJavascriptLibraries(). | 181 // PreloadJavascriptLibraries(). |
179 std::string preload_test_fixture_; | 182 std::string preload_test_fixture_; |
180 std::string preload_test_name_; | 183 std::string preload_test_name_; |
| 184 |
| 185 // The WebUI instance used for testing. |
| 186 WebUI* web_ui_instance_; |
181 }; | 187 }; |
182 | 188 |
183 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ | 189 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ |
OLD | NEW |