| 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 "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/web_ui_message_handler.h" | 12 #include "content/public/browser/web_ui_message_handler.h" |
| 13 | 13 |
| 14 class RenderViewHost; | |
| 15 | |
| 16 namespace base { | 14 namespace base { |
| 17 class ListValue; | 15 class ListValue; |
| 18 } // namespace base | 16 } |
| 17 |
| 18 namespace content { |
| 19 class RenderViewHost; |
| 20 } |
| 19 | 21 |
| 20 // This class registers test framework specific handlers on WebUI objects. | 22 // This class registers test framework specific handlers on WebUI objects. |
| 21 class WebUITestHandler : public content::WebUIMessageHandler, | 23 class WebUITestHandler : public content::WebUIMessageHandler, |
| 22 public content::NotificationObserver { | 24 public content::NotificationObserver { |
| 23 public: | 25 public: |
| 24 WebUITestHandler(); | 26 WebUITestHandler(); |
| 25 | 27 |
| 26 // Sends a message through |preload_host| with the |js_text| to preload at the | 28 // Sends a message through |preload_host| with the |js_text| to preload at the |
| 27 // appropriate time before the onload call is made. | 29 // appropriate time before the onload call is made. |
| 28 void PreloadJavaScript(const string16& js_text, | 30 void PreloadJavaScript(const string16& js_text, |
| 29 RenderViewHost* preload_host); | 31 content::RenderViewHost* preload_host); |
| 30 | 32 |
| 31 // Runs |js_text| in this object's WebUI frame. Does not wait for any result. | 33 // Runs |js_text| in this object's WebUI frame. Does not wait for any result. |
| 32 void RunJavaScript(const string16& js_text); | 34 void RunJavaScript(const string16& js_text); |
| 33 | 35 |
| 34 // Runs |js_text| in this object's WebUI frame. Waits for result, logging an | 36 // Runs |js_text| in this object's WebUI frame. Waits for result, logging an |
| 35 // error message on failure. Returns test pass/fail. | 37 // error message on failure. Returns test pass/fail. |
| 36 bool RunJavaScriptTestWithResult(const string16& js_text); | 38 bool RunJavaScriptTestWithResult(const string16& js_text); |
| 37 | 39 |
| 38 // WebUIMessageHandler overrides. | 40 // WebUIMessageHandler overrides. |
| 39 // Add test handlers to the current WebUI object. | 41 // Add test handlers to the current WebUI object. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 67 // pass/fail. | 69 // pass/fail. |
| 68 bool run_test_succeeded_; | 70 bool run_test_succeeded_; |
| 69 | 71 |
| 70 // Waiting for a test to finish. | 72 // Waiting for a test to finish. |
| 71 bool is_waiting_; | 73 bool is_waiting_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(WebUITestHandler); | 75 DISALLOW_COPY_AND_ASSIGN(WebUITestHandler); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ | 78 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_TEST_HANDLER_H_ |
| OLD | NEW |