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

Unified Diff: webkit/tools/test_shell/layout_test_controller.cc

Issue 196128: Hook up WebViewClient, part 1.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
Index: webkit/tools/test_shell/layout_test_controller.cc
===================================================================
--- webkit/tools/test_shell/layout_test_controller.cc (revision 26230)
+++ webkit/tools/test_shell/layout_test_controller.cc (working copy)
@@ -14,6 +14,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_util.h"
+#include "webkit/api/public/WebConsoleMessage.h"
#include "webkit/api/public/WebFrame.h"
#include "webkit/api/public/WebKit.h"
#include "webkit/api/public/WebScriptSource.h"
@@ -28,6 +29,7 @@
using std::string;
using std::wstring;
+using WebKit::WebConsoleMessage;
using WebKit::WebScriptSource;
using WebKit::WebString;
@@ -839,8 +841,7 @@
if (valueString == "false")
return false;
}
- shell_->delegate()->AddMessageToConsole(shell_->webView(),
- L"Invalid value. Expected boolean value.", 0, L"");
+ LogErrorToConsole("Invalid value. Expected boolean value.");
return false;
}
@@ -852,8 +853,7 @@
if (StringToInt(value.ToString(), &number))
return number;
}
- shell_->delegate()->AddMessageToConsole(shell_->webView(),
- L"Invalid value for preference. Expected integer value.", 0, L"");
+ LogErrorToConsole("Invalid value for preference. Expected integer value.");
return 0;
}
@@ -861,8 +861,7 @@
const CppVariant& value) {
if (value.isString())
return UTF8ToWide(value.ToString());
- shell_->delegate()->AddMessageToConsole(shell_->webView(),
- L"Invalid value for preference. Expected string value.", 0, L"");
+ LogErrorToConsole("Invalid value for preference. Expected string value.");
return std::wstring();
}
@@ -924,10 +923,9 @@
else if (key == "WebKitOfflineWebApplicationCacheEnabled")
preferences->application_cache_enabled = CppVariantToBool(value);
else {
- std::wstring message(L"Invalid name for preference: ");
- message.append(ASCIIToWide(key));
- shell_->delegate()->AddMessageToConsole(shell_->webView(),
- message, 0, L"");
+ std::string message("Invalid name for preference: ");
+ message.append(key);
+ LogErrorToConsole(message);
}
preferences->Apply(shell_->webView());
}
@@ -963,3 +961,9 @@
WebString::fromUTF8(args[2].ToString()),
args[3].ToBoolean());
}
+
+void LayoutTestController::LogErrorToConsole(const std::string& text) {
+ shell_->webView()->GetMainFrame()->addMessageToConsole(
+ WebConsoleMessage(WebConsoleMessage::LevelError,
+ WebString::fromUTF8(text)));
+}
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.h ('k') | webkit/tools/test_shell/mac/test_webview_delegate.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698