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 #include "chrome/browser/webui/web_ui_handler_browsertest.h" | 5 #include "content/browser/webui/web_ui_handler_browsertest.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/renderer_host/render_view_host.h" | 8 #include "chrome/browser/renderer_host/render_view_host.h" |
9 #include "chrome/test/ui_test_utils.h" | 9 #include "chrome/test/ui_test_utils.h" |
10 | 10 |
11 bool WebUIHandlerBrowserTest::Execute(const std::string& js_test) { | 11 bool WebUIHandlerBrowserTest::Execute(const std::string& js_test) { |
12 web_ui_->GetRenderViewHost()->ExecuteJavascriptInWebFrame( | 12 web_ui_->GetRenderViewHost()->ExecuteJavascriptInWebFrame( |
13 string16(), UTF8ToUTF16(js_test)); | 13 string16(), UTF8ToUTF16(js_test)); |
14 return WaitForResult(); | 14 return WaitForResult(); |
15 } | 15 } |
(...skipping 16 matching lines...) Expand all Loading... |
32 web_ui_->RegisterMessageCallback("Fail", | 32 web_ui_->RegisterMessageCallback("Fail", |
33 NewCallback(this, &WebUIHandlerBrowserTest::HandleFail)); | 33 NewCallback(this, &WebUIHandlerBrowserTest::HandleFail)); |
34 } | 34 } |
35 | 35 |
36 bool WebUIHandlerBrowserTest::WaitForResult() { | 36 bool WebUIHandlerBrowserTest::WaitForResult() { |
37 is_waiting_ = true; | 37 is_waiting_ = true; |
38 ui_test_utils::RunMessageLoop(); | 38 ui_test_utils::RunMessageLoop(); |
39 is_waiting_ = false; | 39 is_waiting_ = false; |
40 return test_succeeded_; | 40 return test_succeeded_; |
41 } | 41 } |
OLD | NEW |