| 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 "content/browser/webui/web_ui_test_handler.h" | 5 #include "content/browser/webui/web_ui_test_handler.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/test/ui_test_utils.h" | 9 #include "chrome/test/ui_test_utils.h" |
| 10 #include "content/browser/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 MessageLoopForUI::current()->Quit(); | 26 MessageLoopForUI::current()->Quit(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void WebUITestHandler::HandleFail(const ListValue* args) { | 29 void WebUITestHandler::HandleFail(const ListValue* args) { |
| 30 test_succeeded_ = false; | 30 test_succeeded_ = false; |
| 31 if (is_waiting_) | 31 if (is_waiting_) |
| 32 MessageLoopForUI::current()->Quit(); | 32 MessageLoopForUI::current()->Quit(); |
| 33 | 33 |
| 34 std::string message; | 34 std::string message; |
| 35 ASSERT_TRUE(args->GetString(0, &message)); | 35 ASSERT_TRUE(args->GetString(0, &message)); |
| 36 LOG(INFO) << message; | 36 LOG(ERROR) << message; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void WebUITestHandler::RegisterMessages() { | 39 void WebUITestHandler::RegisterMessages() { |
| 40 web_ui_->RegisterMessageCallback("Pass", | 40 web_ui_->RegisterMessageCallback("Pass", |
| 41 NewCallback(this, &WebUITestHandler::HandlePass)); | 41 NewCallback(this, &WebUITestHandler::HandlePass)); |
| 42 web_ui_->RegisterMessageCallback("Fail", | 42 web_ui_->RegisterMessageCallback("Fail", |
| 43 NewCallback(this, &WebUITestHandler::HandleFail)); | 43 NewCallback(this, &WebUITestHandler::HandleFail)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool WebUITestHandler::WaitForResult() { | 46 bool WebUITestHandler::WaitForResult() { |
| 47 is_waiting_ = true; | 47 is_waiting_ = true; |
| 48 ui_test_utils::RunMessageLoop(); | 48 ui_test_utils::RunMessageLoop(); |
| 49 is_waiting_ = false; | 49 is_waiting_ = false; |
| 50 return test_succeeded_; | 50 return test_succeeded_; |
| 51 } | 51 } |
| OLD | NEW |