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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 bool RunJavascriptFunction(const std::string& function_name); | 52 bool RunJavascriptFunction(const std::string& function_name); |
53 bool RunJavascriptFunction(const std::string& function_name, | 53 bool RunJavascriptFunction(const std::string& function_name, |
54 const base::Value& arg); | 54 const base::Value& arg); |
55 bool RunJavascriptFunction(const std::string& function_name, | 55 bool RunJavascriptFunction(const std::string& function_name, |
56 const base::Value& arg1, | 56 const base::Value& arg1, |
57 const base::Value& arg2); | 57 const base::Value& arg2); |
58 bool RunJavascriptFunction(const std::string& function_name, | 58 bool RunJavascriptFunction(const std::string& function_name, |
59 const ConstValueVector& function_arguments); | 59 const ConstValueVector& function_arguments); |
60 | 60 |
61 // Runs a test fixture that may include calls to functions in test_api.js. | 61 // Runs a test fixture that may include calls to functions in test_api.js. |
62 bool RunJavascriptTestF(const std::string& test_fixture, | 62 bool RunJavascriptTestF(bool is_async, |
| 63 const std::string& test_fixture, |
63 const std::string& test_name); | 64 const std::string& test_name); |
64 | 65 |
65 // Runs a test that may include calls to functions in test_api.js. | 66 // Runs a test that may include calls to functions in test_api.js. |
66 bool RunJavascriptTest(const std::string& test_name); | 67 bool RunJavascriptTest(const std::string& test_name); |
67 bool RunJavascriptTest(const std::string& test_name, | 68 bool RunJavascriptTest(const std::string& test_name, |
68 const base::Value& arg); | 69 const base::Value& arg); |
69 bool RunJavascriptTest(const std::string& test_name, | 70 bool RunJavascriptTest(const std::string& test_name, |
70 const base::Value& arg1, | 71 const base::Value& arg1, |
71 const base::Value& arg2); | 72 const base::Value& arg2); |
72 bool RunJavascriptTest(const std::string& test_name, | 73 bool RunJavascriptTest(const std::string& test_name, |
(...skipping 27 matching lines...) Expand all Loading... |
100 | 101 |
101 // Called by javascript-generated test bodies to browse to a page and preload | 102 // Called by javascript-generated test bodies to browse to a page and preload |
102 // the javascript for the given |preload_test_fixture| and | 103 // the javascript for the given |preload_test_fixture| and |
103 // |preload_test_name|. chrome.send will be overridden to allow javascript | 104 // |preload_test_name|. chrome.send will be overridden to allow javascript |
104 // handler mocking. | 105 // handler mocking. |
105 void BrowsePrintPreload(const GURL& browse_to, | 106 void BrowsePrintPreload(const GURL& browse_to, |
106 const std::string& preload_test_fixture, | 107 const std::string& preload_test_fixture, |
107 const std::string& preload_test_name); | 108 const std::string& preload_test_name); |
108 | 109 |
109 protected: | 110 protected: |
| 111 // URL to dummy WebUI page for testing framework. |
| 112 static const char kDummyURL[]; |
| 113 |
110 WebUIBrowserTest(); | 114 WebUIBrowserTest(); |
111 | 115 |
112 // Setup test path. | 116 // Set up test path & override for |kDummyURL|. |
113 virtual void SetUpInProcessBrowserTestFixture(); | 117 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
| 118 |
| 119 // Tear down override for |kDummyURL|. |
| 120 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; |
114 | 121 |
115 // Returns a mock WebUI object under test (if any). | 122 // Returns a mock WebUI object under test (if any). |
116 virtual WebUIMessageHandler* GetMockMessageHandler(); | 123 virtual WebUIMessageHandler* GetMockMessageHandler(); |
117 | 124 |
118 // Returns a file:// GURL constructed from |path| inside the test data dir for | 125 // Returns a file:// GURL constructed from |path| inside the test data dir for |
119 // webui tests. | 126 // webui tests. |
120 static GURL WebUITestDataPathToURL(const FilePath::StringType& path); | 127 static GURL WebUITestDataPathToURL(const FilePath::StringType& path); |
121 | 128 |
122 private: | 129 private: |
123 // TestNavigationObserver::JsInjectionReadyObserver implementation. | 130 // TestNavigationObserver::JsInjectionReadyObserver implementation. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // again. | 168 // again. |
162 bool libraries_preloaded_; | 169 bool libraries_preloaded_; |
163 | 170 |
164 // Saves the states of |test_fixture| and |test_name| for calling | 171 // Saves the states of |test_fixture| and |test_name| for calling |
165 // PreloadJavascriptLibraries(). | 172 // PreloadJavascriptLibraries(). |
166 std::string preload_test_fixture_; | 173 std::string preload_test_fixture_; |
167 std::string preload_test_name_; | 174 std::string preload_test_name_; |
168 }; | 175 }; |
169 | 176 |
170 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ | 177 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ |
OLD | NEW |