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

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

Issue 338056: Add layoutTestController.counterValueForElementById (Closed)
Patch Set: style fix Created 11 years, 2 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 | « webkit/tools/test_shell/layout_test_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/layout_test_controller.cc
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc
index db50fac7ca86c03fbc3bbbc70d2eadef2623ff55..fbedf9cab171a79f3e27f216acd54cf37e5cb869 100644
--- a/webkit/tools/test_shell/layout_test_controller.cc
+++ b/webkit/tools/test_shell/layout_test_controller.cc
@@ -22,6 +22,7 @@
#include "webkit/api/public/WebURL.h"
#include "webkit/api/public/WebView.h"
#include "webkit/glue/dom_operations.h"
+#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/tools/test_shell/simple_database_system.h"
#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
@@ -117,6 +118,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) :
BindMethod("whiteListAccessFromOrigin", &LayoutTestController::whiteListAccessFromOrigin);
BindMethod("clearAllDatabases", &LayoutTestController::clearAllDatabases);
BindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale);
+ BindMethod("counterValueForElementById", &LayoutTestController::counterValueForElementById);
// The following are stubs.
BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive);
@@ -992,6 +994,19 @@ void LayoutTestController::setPOSIXLocale(const CppArgumentList& args,
}
}
+void LayoutTestController::counterValueForElementById(
+ const CppArgumentList& args, CppVariant* result) {
+ result->SetNull();
+ if (args.size() < 1 || !args[0].isString())
+ return;
+ std::wstring counterValue;
+ if (!webkit_glue::CounterValueForElementById(shell_->webView()->mainFrame(),
+ args[0].ToString(),
+ &counterValue))
+ return;
+ result->Set(WideToUTF8(counterValue));
+}
+
void LayoutTestController::LogErrorToConsole(const std::string& text) {
shell_->delegate()->didAddMessageToConsole(
WebConsoleMessage(WebConsoleMessage::LevelError,
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698