| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "content/browser/webui/web_ui.h" | 11 #include "content/browser/webui/web_ui.h" |
| 12 #include "content/common/notification_observer.h" | 12 #include "content/common/notification_observer.h" |
| 13 | 13 |
| 14 // This class registers test framework specific handlers on WebUI objects. | 14 // This class registers test framework specific handlers on WebUI objects. |
| 15 class WebUITestHandler : public WebUIMessageHandler, | 15 class WebUITestHandler : public WebUIMessageHandler, |
| 16 public NotificationObserver { | 16 public NotificationObserver { |
| 17 public: | 17 public: |
| 18 // Runs a string of javascript. Returns pass fail. | 18 // Runs a string of javascript. Returns pass fail. |
| 19 bool RunJavascript(const std::string& js_test, bool is_test); | 19 bool RunJavascript(const std::string& js_test, bool is_test); |
| 20 | 20 |
| 21 private: | 21 private: |
| 22 // WebUIMessageHandler overrides. | 22 // WebUIMessageHandler overrides. |
| 23 // Add test handlers to the current WebUI object. | 23 // Add test handlers to the current WebUI object. |
| 24 virtual void RegisterMessages() {} | 24 virtual void RegisterMessages() {} |
| 25 | 25 |
| 26 // From NotificationObserver. | 26 // From NotificationObserver. |
| 27 virtual void Observe(NotificationType type, | 27 virtual void Observe(int type, |
| 28 const NotificationSource& source, | 28 const NotificationSource& source, |
| 29 const NotificationDetails& details) OVERRIDE; | 29 const NotificationDetails& details) OVERRIDE; |
| 30 | 30 |
| 31 // Runs a message loop until test finishes. Returns the result of the test. | 31 // Runs a message loop until test finishes. Returns the result of the test. |
| 32 bool WaitForResult(); | 32 bool WaitForResult(); |
| 33 | 33 |
| 34 // Pass fail result of current tests. | 34 // Pass fail result of current tests. |
| 35 bool test_succeeded_; | 35 bool test_succeeded_; |
| 36 | 36 |
| 37 // Waiting for a test to finish. | 37 // Waiting for a test to finish. |
| 38 bool is_waiting_; | 38 bool is_waiting_; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ | 41 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ |
| OLD | NEW |