diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-05 00:38:52 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-05 00:38:52 +0000 |
commit | c0af4a04d7ddb82d86f6ddc1ec22aea57585cf86 (patch) | |
tree | b0ef6b0d0852fea0e6a7e9c2fce46d97f3448660 /webkit | |
parent | 6014d67a9c2006e15cfa09babfe5eaf63d57a331 (diff) | |
download | chromium_src-c0af4a04d7ddb82d86f6ddc1ec22aea57585cf86.zip chromium_src-c0af4a04d7ddb82d86f6ddc1ec22aea57585cf86.tar.gz chromium_src-c0af4a04d7ddb82d86f6ddc1ec22aea57585cf86.tar.bz2 |
Implement setSmartInsertDeleteEnabled and setSelectTrailingWhitespaceEnabled
in the test shell. This causes us to pass at least 2 more tests.
Review URL: http://codereview.chromium.org/12933
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6404 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webview_delegate.h | 15 | ||||
-rw-r--r-- | webkit/tools/layout_tests/test_lists/tests_fixable.txt | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 22 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 5 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.cc | 22 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_webview_delegate.h | 13 |
7 files changed, 81 insertions, 6 deletions
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h index 6ea074c..cfdc99e 100644 --- a/webkit/glue/webview_delegate.h +++ b/webkit/glue/webview_delegate.h @@ -30,6 +30,7 @@ #include <vector> #include "base/basictypes.h" +#include "base/logging.h" #include "googleurl/src/gurl.h" #include "webkit/glue/context_node_types.h" #include "webkit/glue/webwidget_delegate.h" @@ -631,7 +632,13 @@ class WebViewDelegate : virtual public WebWidgetDelegate { } virtual bool SmartInsertDeleteEnabled() { - return false; + return true; + } + + virtual void SetSmartInsertDeleteEnabled(bool enabled) { + // This method is only used in test shell, which overrides this + // method. + NOTREACHED(); } virtual bool IsSelectTrailingWhitespaceEnabled() { @@ -642,6 +649,12 @@ class WebViewDelegate : virtual public WebWidgetDelegate { #endif } + virtual void SetSelectTrailingWhitespaceEnabled(bool enabled) { + // This method is only used in test shell, which overrides this + // method. + NOTREACHED(); + } + virtual void DidBeginEditing() { } virtual void DidChangeSelection(bool is_empty_selection) { } virtual void DidChangeContents() { } diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt index a86162a..7e945d5 100644 --- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt +++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt @@ -1343,7 +1343,6 @@ LayoutTests/http/tests/misc/dns-prefetch-control.html = FAIL TIMEOUT PASS DEBUG : LayoutTests/tables/mozilla_expected_failures/marvin/table_overflow_dirty_reflow_tbody.html = FAIL PASS // NEW FOR MERGE 37604:38097 -LayoutTests/editing/deleting/smart-editing-disabled.html = FAIL LayoutTests/fast/events/destroyed-atomic-string.html = FAIL LayoutTests/fast/js/exception-thrown-from-new.html = FAIL LayoutTests/fast/js/global-constructors.html = FAIL @@ -1461,7 +1460,6 @@ LayoutTests/http/tests/misc/single-character-pi-stylesheet.xhtml = FAIL LayoutTests/fast/workers/stress-js-execution.html = TIMEOUT // MERGE 38729:38760: New tests -LayoutTests/editing/selection/doubleclick-whitespace.html = FAIL LayoutTests/fast/workers/worker-terminate.html = TIMEOUT LayoutTests/http/tests/misc/timer-vs-loading.html = TIMEOUT diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 86e0527..79494b2 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -94,6 +94,8 @@ LayoutTestController::LayoutTestController(TestShell* shell) { BindMethod("execCommand", &LayoutTestController::execCommand); BindMethod("setPopupBlockingEnabled", &LayoutTestController::setPopupBlockingEnabled); BindMethod("setStopProvisionalFrameLoads", &LayoutTestController::setStopProvisionalFrameLoads); + BindMethod("setSmartInsertDeleteEnabled", &LayoutTestController::setSmartInsertDeleteEnabled); + BindMethod("setSelectTrailingWhitespaceEnabled", &LayoutTestController::setSelectTrailingWhitespaceEnabled); // The following are stubs. BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive); @@ -534,6 +536,25 @@ void LayoutTestController::setStopProvisionalFrameLoads( stop_provisional_frame_loads_ = true; } +void LayoutTestController::setSmartInsertDeleteEnabled( + const CppArgumentList& args, CppVariant* result) { + if (args.size() > 0 && args[0].isBool()) { + shell_->delegate()->SetSmartInsertDeleteEnabled(args[0].value.boolValue); + } + + result->SetNull(); +} + +void LayoutTestController::setSelectTrailingWhitespaceEnabled( + const CppArgumentList& args, CppVariant* result) { + if (args.size() > 0 && args[0].isBool()) { + shell_->delegate()->SetSelectTrailingWhitespaceEnabled( + args[0].value.boolValue); + } + + result->SetNull(); +} + // // Unimplemented stubs // @@ -615,4 +636,3 @@ void LayoutTestController::fallbackMethod( } result->SetNull(); } - diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index c6a46e2..f6ddc82 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -122,6 +122,14 @@ class LayoutTestController : public CppBoundClass { void setStopProvisionalFrameLoads(const CppArgumentList& args, CppVariant* result); + // Enable or disable smart insert/delete. This is enabled by default. + void setSmartInsertDeleteEnabled(const CppArgumentList& args, + CppVariant* result); + + // Enable or disable trailing whitespace selection on double click. + void setSelectTrailingWhitespaceEnabled(const CppArgumentList& args, + CppVariant* result); + // The following are only stubs. TODO(pamg): Implement any of these that // are needed to pass the layout tests. void dumpAsWebArchive(const CppArgumentList& args, CppVariant* result); diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index 95b0d47..90c7f64 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -119,6 +119,11 @@ public: void ResetTestController() { layout_test_controller_->Reset(); event_sending_controller_->Reset(); + + // Reset state in the test webview delegate. We don't need to call + // SetSelectTrailingWhitespaceEnabled because enabling smart + // insert/delete will disable select trailing whitespace. + delegate()->SetSmartInsertDeleteEnabled(true); } // Passes options from LayoutTestController through to the delegate (or diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index 061cc9b..99be83c 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -548,7 +548,27 @@ bool TestWebViewDelegate::ShouldApplyStyle(WebView* webview, } bool TestWebViewDelegate::SmartInsertDeleteEnabled() { - return true; + return smart_insert_delete_enabled_; +} + +void TestWebViewDelegate::SetSmartInsertDeleteEnabled(bool enabled) { + smart_insert_delete_enabled_ = enabled; + // In upstream WebKit, smart insert/delete is mutually exclusive with select + // trailing whitespace. + if (enabled) + select_trailing_whitespace_enabled_ = false; +} + +bool TestWebViewDelegate::IsSelectTrailingWhitespaceEnabled() { + return select_trailing_whitespace_enabled_; +} + +void TestWebViewDelegate::SetSelectTrailingWhitespaceEnabled(bool enabled) { + select_trailing_whitespace_enabled_ = enabled; + // In upstream WebKit, smart insert/delete is mutually exclusive with select + // trailing whitespace. + if (enabled) + smart_insert_delete_enabled_ = false; } void TestWebViewDelegate::DidBeginEditing() { diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h index 1bded4f..66d7d84 100644 --- a/webkit/tools/test_shell/test_webview_delegate.h +++ b/webkit/tools/test_shell/test_webview_delegate.h @@ -59,7 +59,9 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, shell_(shell), top_loading_frame_(NULL), page_id_(-1), - last_page_id_updated_(-1) + last_page_id_updated_(-1), + smart_insert_delete_enabled_(true), + select_trailing_whitespace_enabled_(false) #if defined(OS_WIN) , custom_cursor_(NULL) #elif defined(OS_LINUX) @@ -175,6 +177,9 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, std::wstring style, std::wstring range); virtual bool SmartInsertDeleteEnabled(); + virtual void SetSmartInsertDeleteEnabled(bool enabled); + virtual bool IsSelectTrailingWhitespaceEnabled(); + virtual void SetSelectTrailingWhitespaceEnabled(bool enabled); virtual void DidBeginEditing(); virtual void DidChangeSelection(bool is_empty_selection); virtual void DidChangeContents(); @@ -295,6 +300,12 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>, ResourceMap resource_identifier_map_; std::string GetResourceDescription(uint32 identifier); + // true if we want to enable smart insert/delete. + bool smart_insert_delete_enabled_; + + // true if we want to enable selection of trailing whitespaces + bool select_trailing_whitespace_enabled_; + #if defined(OS_WIN) HCURSOR custom_cursor_; |