From 32732d3bab0bfa936a66dc0386234093be63c3b2 Mon Sep 17 00:00:00 2001 From: "dumi@chromium.org" Date: Mon, 30 Aug 2010 21:16:41 +0000 Subject: Add LayoutTestController::markerTextForListItem(). BUG=53289 TEST=none Review URL: http://codereview.chromium.org/3252004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57910 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/tools/test_shell/layout_test_controller.cc | 30 +++++++++++++++++++---- webkit/tools/test_shell/layout_test_controller.h | 3 +++ 2 files changed, 28 insertions(+), 5 deletions(-) (limited to 'webkit/tools') diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index d6cc4b8..32f5188 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -15,7 +15,10 @@ #include "base/path_service.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" +#include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" +#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/WebKit/chromium/public/WebElement.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceMock.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" @@ -38,10 +41,15 @@ using std::string; using std::wstring; +using WebKit::WebBindings; using WebKit::WebConsoleMessage; +using WebKit::WebElement; +using WebKit::WebGeolocationServiceMock; using WebKit::WebScriptSource; using WebKit::WebSecurityPolicy; +using WebKit::WebSize; using WebKit::WebString; +using WebKit::WebURL; TestShell* LayoutTestController::shell_ = NULL; // Most of these flags need to be cleared in Reset() so that they get turned @@ -178,6 +186,8 @@ LayoutTestController::LayoutTestController(TestShell* shell) : BindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition); BindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError); + BindMethod("markerTextForListItem", &LayoutTestController::markerTextForListItem); + // The fallback method is called when an unknown method is invoked. BindFallbackMethod(&LayoutTestController::fallbackMethod); @@ -890,7 +900,7 @@ void LayoutTestController::dumpSelectionRect( void LayoutTestController::display( const CppArgumentList& args, CppVariant* result) { WebViewHost* view_host = shell_->webViewHost(); - const WebKit::WebSize& size = view_host->webview()->size(); + const WebSize& size = view_host->webview()->size(); gfx::Rect rect(size.width, size.height); view_host->UpdatePaintRect(rect); view_host->Paint(); @@ -1129,7 +1139,7 @@ void LayoutTestController::addOriginAccessWhitelistEntry( !args[2].isString() || !args[3].isBool()) return; - WebKit::WebURL url(GURL(args[0].ToString())); + WebURL url(GURL(args[0].ToString())); if (!url.isValid()) return; @@ -1148,7 +1158,7 @@ void LayoutTestController::removeOriginAccessWhitelistEntry( !args[2].isString() || !args[3].isBool()) return; - WebKit::WebURL url(GURL(args[0].ToString())); + WebURL url(GURL(args[0].ToString())); if (!url.isValid()) return; @@ -1319,7 +1329,7 @@ void LayoutTestController::setMockGeolocationPosition( if (args.size() < 3 || !args[0].isNumber() || !args[1].isNumber() || !args[2].isNumber()) return; - WebKit::WebGeolocationServiceMock::setMockGeolocationPosition( + WebGeolocationServiceMock::setMockGeolocationPosition( args[0].ToDouble(), args[1].ToDouble(), args[2].ToDouble()); } @@ -1328,6 +1338,16 @@ void LayoutTestController::setMockGeolocationError(const CppArgumentList& args, if (args.size() < 2 || !args[0].isInt32() || !args[1].isString()) return; - WebKit::WebGeolocationServiceMock::setMockGeolocationError( + WebGeolocationServiceMock::setMockGeolocationError( args[0].ToInt32(), WebString::fromUTF8(args[1].ToString())); } + +void LayoutTestController::markerTextForListItem(const CppArgumentList& args, + CppVariant* result) { + WebElement element; + if (!WebBindings::getElement(args[0].value.objectValue, &element)) + result->SetNull(); + else + result->Set( + element.document().frame()->markerTextForListItem(element).utf8()); +} diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index 8394d8b..28ae5ea 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -283,6 +283,9 @@ class LayoutTestController : public CppBoundClass { void setMockGeolocationError(const CppArgumentList& args, CppVariant* result); + void markerTextForListItem(const CppArgumentList& args, + CppVariant* result); + public: // The following methods are not exposed to JavaScript. void SetWorkQueueFrozen(bool frozen) { work_queue_.set_frozen(frozen); } -- cgit v1.1