OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/web_ui_test_handler.h" | 5 #include "chrome/browser/ui/webui/web_ui_test_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
(...skipping 10 matching lines...) Expand all Loading... |
22 test_succeeded_(false), | 22 test_succeeded_(false), |
23 run_test_done_(false), | 23 run_test_done_(false), |
24 run_test_succeeded_(false), | 24 run_test_succeeded_(false), |
25 is_waiting_(false) { | 25 is_waiting_(false) { |
26 } | 26 } |
27 | 27 |
28 void WebUITestHandler::PreloadJavaScript(const string16& js_text, | 28 void WebUITestHandler::PreloadJavaScript(const string16& js_text, |
29 RenderViewHost* preload_host) { | 29 RenderViewHost* preload_host) { |
30 DCHECK(preload_host); | 30 DCHECK(preload_host); |
31 preload_host->Send(new ChromeViewMsg_WebUIJavaScript( | 31 preload_host->Send(new ChromeViewMsg_WebUIJavaScript( |
32 preload_host->routing_id(), string16(), js_text, 0, | 32 preload_host->GetRoutingID(), string16(), js_text, 0, |
33 false)); | 33 false)); |
34 } | 34 } |
35 | 35 |
36 void WebUITestHandler::RunJavaScript(const string16& js_text) { | 36 void WebUITestHandler::RunJavaScript(const string16& js_text) { |
37 web_ui()->GetWebContents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame( | 37 web_ui()->GetWebContents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame( |
38 string16(), js_text); | 38 string16(), js_text); |
39 } | 39 } |
40 | 40 |
41 bool WebUITestHandler::RunJavaScriptTestWithResult(const string16& js_text) { | 41 bool WebUITestHandler::RunJavaScriptTestWithResult(const string16& js_text) { |
42 test_succeeded_ = false; | 42 test_succeeded_ = false; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // complete. | 110 // complete. |
111 if (!run_test_done_ || (run_test_succeeded_ && !test_done_)) { | 111 if (!run_test_done_ || (run_test_succeeded_ && !test_done_)) { |
112 ui_test_utils::RunMessageLoop(); | 112 ui_test_utils::RunMessageLoop(); |
113 } | 113 } |
114 | 114 |
115 is_waiting_ = false; | 115 is_waiting_ = false; |
116 | 116 |
117 // To succeed the test must execute as well as pass the test. | 117 // To succeed the test must execute as well as pass the test. |
118 return run_test_succeeded_ && test_succeeded_; | 118 return run_test_succeeded_ && test_succeeded_; |
119 } | 119 } |
OLD | NEW |