| 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_WEBUI_WEB_UI_HANDLER_BROWSERTEST_H_ | 5 #ifndef CONTENT_BROWSER_WEBUI_WEB_UI_HANDLER_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_WEBUI_WEB_UI_HANDLER_BROWSERTEST_H_ | 6 #define CONTENT_BROWSER_WEBUI_WEB_UI_HANDLER_BROWSERTEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/webui/web_ui.h" | 11 #include "content/browser/webui/web_ui.h" |
| 12 | 12 |
| 13 // This class registers test framework specific handlers on WebUI objects. | 13 // This class registers test framework specific handlers on WebUI objects. |
| 14 class WebUIHandlerBrowserTest : public WebUIMessageHandler { | 14 class WebUIHandlerBrowserTest : public WebUIMessageHandler { |
| 15 public: | 15 public: |
| 16 // Executes a string of javascript. Returns pass fail. | 16 // Executes a string of javascript. Returns pass fail. |
| 17 bool Execute(const std::string& js_test); | 17 bool Execute(const std::string& js_test); |
| 18 | 18 |
| 19 protected: | 19 protected: |
| 20 // WebUI handlers which deliver results to any waiting message loops. | 20 // WebUI handlers which deliver results to any waiting message loops. |
| 21 // |args| is currently ignored. | 21 // |args| is currently ignored. |
| 22 void HandlePass(const ListValue* args); | 22 void HandlePass(const ListValue* args); |
| 23 void HandleFail(const ListValue* args); | 23 void HandleFail(const ListValue* args); |
| 24 | 24 |
| 25 // WebUIMessageHandler overrides. | 25 // WebUIMessageHandler overrides. |
| 26 // Add test handlers to the current WebUI object. | 26 // Add test handlers to the current WebUI object. |
| 27 virtual void RegisterMessages(); | 27 virtual void RegisterMessages(); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 // Runs a message loop until test finishes. Returns the result of the test. | 30 // Runs a message loop until test finishes. Returns the result of the test. |
| 31 bool WaitForResult(); | 31 bool WaitForResult(); |
| 32 | 32 |
| 33 // Pass fail result of current tests. | 33 // Pass fail result of current tests. |
| 34 bool test_succeeded_; | 34 bool test_succeeded_; |
| 35 | 35 |
| 36 // Waiting for a test to finish. | 36 // Waiting for a test to finish. |
| 37 bool is_waiting_; | 37 bool is_waiting_; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 #endif // CHROME_BROWSER_WEBUI_WEB_UI_HANDLER_BROWSERTEST_H_ | 40 #endif // CONTENT_BROWSER_WEBUI_WEB_UI_HANDLER_BROWSERTEST_H_ |
| OLD | NEW |