Chromium Code Reviews| Index: chrome/browser/ui/webui/web_ui_test_handler.h |
| diff --git a/chrome/browser/ui/webui/web_ui_test_handler.h b/chrome/browser/ui/webui/web_ui_test_handler.h |
| index 4c2ea3855b7ace2f4b05ca71bd24885379677902..67c4b1d0dfa8abe132e8e79eecb59a8bdc21dad2 100644 |
| --- a/chrome/browser/ui/webui/web_ui_test_handler.h |
| +++ b/chrome/browser/ui/webui/web_ui_test_handler.h |
| @@ -10,10 +10,18 @@ |
| #include "content/browser/webui/web_ui.h" |
| #include "content/common/notification_observer.h" |
| +namespace base { |
| + |
| +class ListValue; |
| + |
| +} // namespace base |
| + |
| // This class registers test framework specific handlers on WebUI objects. |
| class WebUITestHandler : public WebUIMessageHandler, |
| public NotificationObserver { |
| public: |
| + WebUITestHandler(); |
| + |
| // Sends a message through |preload_host| with the |js_text| to preload at the |
| // appropriate time before the onload call is made. |
| void PreloadJavaScript(const string16& js_text, |
| @@ -23,27 +31,48 @@ class WebUITestHandler : public WebUIMessageHandler, |
| void RunJavaScript(const string16& js_text); |
| // Runs |js_text| in this object's WebUI frame. Waits for result, logging an |
| - // error message on failure. Returns test pass/fail. |
| - bool RunJavaScriptTestWithResult(const string16& js_text); |
| + // error message on failure. Returns test pass/fail. When |is_async| is true, |
| + // waits for asyncTestDone() to be called from javascript code. |
| + bool RunJavaScriptTestWithResult(const string16& js_text, bool is_async); |
| private: |
| // WebUIMessageHandler overrides. |
| // Add test handlers to the current WebUI object. |
| - virtual void RegisterMessages() OVERRIDE {} |
| + virtual void RegisterMessages() OVERRIDE; |
| + |
| + // Receives asyncTestResult messages. |
| + void HandleAsyncTestResult(const base::ListValue* test_result); |
| + |
| + // Populates |success| from |test_result|, logging messages to ERROR, upon |
|
mmenke
2011/08/10 17:23:40
nit: Second comma not needed.
Sheridan Rawlins
2011/08/11 01:58:44
Done.
|
| + // failure. |
| + void HandleTestResult(const base::ListValue* test_result, bool* success); |
| // From NotificationObserver. |
| virtual void Observe(int type, |
| const NotificationSource& source, |
| const NotificationDetails& details) OVERRIDE; |
| - // Runs a message loop until test finishes. Returns the result of the test. |
| - bool WaitForResult(); |
| + // Runs a message loop until test finishes. Returns the result of the |
| + // test. When |is_async| is true, waits for asyncTestDone() to be called from |
| + // javascript code. |
| + bool WaitForResult(bool is_async); |
| - // Pass fail result of current tests. |
| + // Pass fail result of current test. |
| bool test_succeeded_; |
| + // Pass fail result of current async test. |
| + bool test_succeeded_async_; |
| + |
| // Waiting for a test to finish. |
| bool is_waiting_; |
| + |
| + // Received sync completion pass/fail; |
| + bool test_done_; |
| + |
| + // Received async completion pass/fail; |
| + bool test_done_async_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebUITestHandler); |
| }; |
| #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ |