| 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_TEST_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "content/public/browser/web_ui_message_handler.h" | 10 #include "content/public/browser/web_ui_message_handler.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Runs |js_text| in this object's WebUI frame. Does not wait for any result. | 31 // Runs |js_text| in this object's WebUI frame. Does not wait for any result. |
| 32 void RunJavaScript(const base::string16& js_text); | 32 void RunJavaScript(const base::string16& js_text); |
| 33 | 33 |
| 34 // Runs |js_text| in this object's WebUI frame. Waits for result, logging an | 34 // Runs |js_text| in this object's WebUI frame. Waits for result, logging an |
| 35 // error message on failure. Returns test pass/fail. | 35 // error message on failure. Returns test pass/fail. |
| 36 bool RunJavaScriptTestWithResult(const base::string16& js_text); | 36 bool RunJavaScriptTestWithResult(const base::string16& js_text); |
| 37 | 37 |
| 38 // WebUIMessageHandler overrides. | 38 // WebUIMessageHandler overrides. |
| 39 // Add test handlers to the current WebUI object. | 39 // Add test handlers to the current WebUI object. |
| 40 virtual void RegisterMessages() OVERRIDE; | 40 virtual void RegisterMessages() override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 // Receives testResult messages. | 43 // Receives testResult messages. |
| 44 void HandleTestResult(const base::ListValue* test_result); | 44 void HandleTestResult(const base::ListValue* test_result); |
| 45 | 45 |
| 46 // Gets the callback that Javascript execution is complete. | 46 // Gets the callback that Javascript execution is complete. |
| 47 void JavaScriptComplete(const base::Value* result); | 47 void JavaScriptComplete(const base::Value* result); |
| 48 | 48 |
| 49 // Runs a message loop until test finishes. Returns the result of the | 49 // Runs a message loop until test finishes. Returns the result of the |
| 50 // test. | 50 // test. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 65 // pass/fail. | 65 // pass/fail. |
| 66 bool run_test_succeeded_; | 66 bool run_test_succeeded_; |
| 67 | 67 |
| 68 // Waiting for a test to finish. | 68 // Waiting for a test to finish. |
| 69 bool is_waiting_; | 69 bool is_waiting_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(WebUITestHandler); | 71 DISALLOW_COPY_AND_ASSIGN(WebUITestHandler); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ | 74 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ |
| OLD | NEW |