Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(884)

Unified Diff: chrome/browser/ui/webui/web_ui_test_handler.cc

Issue 11801014: Switch WebUITestHandler to use ExecuteJavascriptInWebFrameCallbackResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/web_ui_test_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/web_ui_test_handler.cc
diff --git a/chrome/browser/ui/webui/web_ui_test_handler.cc b/chrome/browser/ui/webui/web_ui_test_handler.cc
index cbb2d4249fe32184b902a111b42369698d83eddf..2f13e9f30dd2909753c156ba692a1b43dc8499aa 100644
--- a/chrome/browser/ui/webui/web_ui_test_handler.cc
+++ b/chrome/browser/ui/webui/web_ui_test_handler.cc
@@ -44,11 +44,11 @@ bool WebUITestHandler::RunJavaScriptTestWithResult(const string16& js_text) {
test_succeeded_ = false;
run_test_succeeded_ = false;
RenderViewHost* rvh = web_ui()->GetWebContents()->GetRenderViewHost();
- content::NotificationRegistrar notification_registrar;
- notification_registrar.Add(
- this, content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT,
- content::Source<RenderViewHost>(rvh));
- rvh->ExecuteJavascriptInWebFrameNotifyResult(string16(), js_text);
+ rvh->ExecuteJavascriptInWebFrameCallbackResult(
+ string16(), // frame_xpath
+ js_text,
+ base::Bind(&WebUITestHandler::JavaScriptComplete,
+ base::Unretained(this)));
return WaitForResult();
}
@@ -77,24 +77,19 @@ void WebUITestHandler::HandleTestResult(const ListValue* test_result) {
}
}
-void WebUITestHandler::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+void WebUITestHandler::JavaScriptComplete(const base::Value* result) {
// Quit the message loop if |is_waiting_| so waiting process can get result or
// error. To ensure this gets done, do this before ASSERT* calls.
if (is_waiting_)
MessageLoopForUI::current()->Quit();
- ASSERT_EQ(content::NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT, type);
-
- SCOPED_TRACE("WebUITestHandler::Observe");
+ SCOPED_TRACE("WebUITestHandler::JavaScriptComplete");
EXPECT_FALSE(run_test_done_);
run_test_done_ = true;
run_test_succeeded_ = false;
- Value* value = content::Details<std::pair<int, Value*> >(details)->second;
- ASSERT_TRUE(value->GetAsBoolean(&run_test_succeeded_));
+ ASSERT_TRUE(result->GetAsBoolean(&run_test_succeeded_));
}
bool WebUITestHandler::WaitForResult() {
« no previous file with comments | « chrome/browser/ui/webui/web_ui_test_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698