diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-18 23:56:41 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-18 23:56:41 +0000 |
commit | 5d846d975e6febb772269fabb22ddde52842a1c5 (patch) | |
tree | d3955f8575aea23ad4e308438895c5b65db10f6b /webkit | |
parent | 6edb59d11201e7496fc1fbd5b3467e31b297bff2 (diff) | |
download | chromium_src-5d846d975e6febb772269fabb22ddde52842a1c5.zip chromium_src-5d846d975e6febb772269fabb22ddde52842a1c5.tar.gz chromium_src-5d846d975e6febb772269fabb22ddde52842a1c5.tar.bz2 |
Added the new isCommandEnabled() layout test function to the layout test controller.
Fixes one new layout test.
Review URL: http://codereview.chromium.org/14871
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7277 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webframe.h | 5 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.cc | 6 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.h | 1 | ||||
-rw-r--r-- | webkit/tools/layout_tests/test_lists/tests_fixable.txt | 1 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 13 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 5 |
6 files changed, 29 insertions, 2 deletions
diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index 60052dc..212bcab 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -323,6 +323,11 @@ class WebFrame : public base::RefCounted<WebFrame> { virtual bool ExecuteCoreCommandByName(const std::string& name, const std::string& value) = 0; + // Checks whether a webkit editor command is currently enabled. This + // method is exposed in order to implement + // javascript:layoutTestController.isCommandEnabled() + virtual bool IsCoreCommandEnabled(const std::string& name) = 0; + // Adds a message to the frame's console. virtual void AddMessageToConsole(const std::wstring& msg, ConsoleMessageLevel level) = 0; diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index dbcca01..9f9dd1d 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -1675,6 +1675,12 @@ bool WebFrameImpl::ExecuteCoreCommandByName(const std::string& name, .execute(webkit_glue::StdStringToString(value)); } +bool WebFrameImpl::IsCoreCommandEnabled(const std::string& name) { + ASSERT(frame()); + return frame()->editor()->command(webkit_glue::StdStringToString(name)) + .isEnabled(); +} + void WebFrameImpl::AddMessageToConsole(const std::wstring& msg, ConsoleMessageLevel level) { ASSERT(frame()); diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index b7d6753..87f630c 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -156,6 +156,7 @@ class WebFrameImpl : public WebFrame { virtual WebTextInput* GetTextInput(); virtual bool ExecuteCoreCommandByName(const std::string& name, const std::string& value); + virtual bool IsCoreCommandEnabled(const std::string& name); virtual void AddMessageToConsole(const std::wstring& msg, ConsoleMessageLevel level); diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt index f251d93..3836a24 100644 --- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt @@ -1654,7 +1654,6 @@ LINUX WIN : LayoutTests/fast/repaint/transform-repaint-descendants.html = FAIL LINUX WIN : LayoutTests/http/tests/loading/simple-subframe.html = FAIL // WebKit Merge 39100:39141 new tests: -LayoutTests/editing/execCommand/enabling-and-selection-2.html = FAIL SKIP : LayoutTests/fast/dom/Window/timeout-released-on-close.html = FAIL LayoutTests/fast/events/special-key-events-in-input-text.html = FAIL LayoutTests/fast/regex/non-pattern-characters.html = FAIL diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 96a7865..c6a3588 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -92,6 +92,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) { BindMethod("pathToLocalResource", &LayoutTestController::pathToLocalResource); BindMethod("addFileToPasteboardOnDrag", &LayoutTestController::addFileToPasteboardOnDrag); BindMethod("execCommand", &LayoutTestController::execCommand); + BindMethod("isCommandEnabled", &LayoutTestController::isCommandEnabled); BindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingEnabled); BindMethod("setStopProvisionalFrameLoads", &LayoutTestController::setStopProvisionalFrameLoads); BindMethod("setSmartInsertDeleteEnabled", &LayoutTestController::setSmartInsertDeleteEnabled); @@ -472,6 +473,18 @@ void LayoutTestController::execCommand( result->SetNull(); } +void LayoutTestController::isCommandEnabled( + const CppArgumentList& args, CppVariant* result) { + if (args.size() <= 0 || !args[0].isString()) { + result->SetNull(); + return; + } + + std::string command = args[0].ToString(); + bool rv = shell_->webView()->GetFocusedFrame()->IsCoreCommandEnabled(command); + result->Set(rv); +} + void LayoutTestController::setPopupBlockingEnabled( const CppArgumentList& args, CppVariant* result) { if (args.size() > 0 && args[0].isBool()) { diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index f6ddc82..3cc4e31 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -111,9 +111,12 @@ class LayoutTestController : public CppBoundClass { // with a fake file object. void addFileToPasteboardOnDrag(const CppArgumentList& args, CppVariant* result); - // Executes an internal command (superset of document.execCommand() commands) + // Executes an internal command (superset of document.execCommand() commands). void execCommand(const CppArgumentList& args, CppVariant* result); + // Checks if an internal command is currently available. + void isCommandEnabled(const CppArgumentList& args, CppVariant* result); + // Set the WebPreference that controls webkit's popup blocking. void setPopupBlockingEnabled(const CppArgumentList& args, CppVariant* result); |