summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/test_webview_delegate.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 22:13:03 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 22:13:03 +0000
commit04fc948392b6fba1e640bd97eeea2293d9ed9b7e (patch)
tree3c413c4bf8d139cdf932fdfc4b8a7e3cc812313f /webkit/tools/test_shell/test_webview_delegate.cc
parente0d0014eb45448bf6bc59d905707d242f7517ba6 (diff)
downloadchromium_src-04fc948392b6fba1e640bd97eeea2293d9ed9b7e.zip
chromium_src-04fc948392b6fba1e640bd97eeea2293d9ed9b7e.tar.gz
chromium_src-04fc948392b6fba1e640bd97eeea2293d9ed9b7e.tar.bz2
Fold WebEditingClient into WebViewClient.
R=dglazkov BUG=none TEST=none Review URL: http://codereview.chromium.org/211032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/test_webview_delegate.cc')
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc278
1 files changed, 109 insertions, 169 deletions
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index e8346dc..043d62f 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -327,13 +327,119 @@ void TestWebViewDelegate::didAddMessageToConsole(
}
}
-void TestWebViewDelegate::printPage(WebFrame* frame) {
+// The output from these methods in layout test mode should match that
+// expected by the layout tests. See EditingDelegate.m in DumpRenderTree.
+
+bool TestWebViewDelegate::shouldBeginEditing(const WebRange& range) {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n",
+ GetRangeDescription(range).c_str());
+ }
+ return shell_->AcceptsEditing();
+}
+
+bool TestWebViewDelegate::shouldEndEditing(const WebRange& range) {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n",
+ GetRangeDescription(range).c_str());
+ }
+ return shell_->AcceptsEditing();
+}
+
+bool TestWebViewDelegate::shouldInsertNode(const WebNode& node,
+ const WebRange& range,
+ WebEditingAction action) {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: shouldInsertNode:%s "
+ "replacingDOMRange:%s givenAction:%s\n",
+ GetNodeDescription(node, 0).c_str(),
+ GetRangeDescription(range).c_str(),
+ GetEditingActionDescription(action).c_str());
+ }
+ return shell_->AcceptsEditing();
+}
+
+bool TestWebViewDelegate::shouldInsertText(const WebString& text,
+ const WebRange& range,
+ WebEditingAction action) {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: shouldInsertText:%s "
+ "replacingDOMRange:%s givenAction:%s\n",
+ text.utf8().data(),
+ GetRangeDescription(range).c_str(),
+ GetEditingActionDescription(action).c_str());
+ }
+ return shell_->AcceptsEditing();
+}
+
+bool TestWebViewDelegate::shouldChangeSelectedRange(const WebRange& from_range,
+ const WebRange& to_range,
+ WebTextAffinity affinity,
+ bool still_selecting) {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s "
+ "toDOMRange:%s affinity:%s stillSelecting:%s\n",
+ GetRangeDescription(from_range).c_str(),
+ GetRangeDescription(to_range).c_str(),
+ GetTextAffinityDescription(affinity).c_str(),
+ (still_selecting ? "TRUE" : "FALSE"));
+ }
+ return shell_->AcceptsEditing();
+}
+
+bool TestWebViewDelegate::shouldDeleteRange(const WebRange& range) {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n",
+ GetRangeDescription(range).c_str());
+ }
+ return shell_->AcceptsEditing();
+}
+
+bool TestWebViewDelegate::shouldApplyStyle(const WebString& style,
+ const WebRange& range) {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n",
+ style.utf8().data(),
+ GetRangeDescription(range).c_str());
+ }
+ return shell_->AcceptsEditing();
+}
+
+bool TestWebViewDelegate::isSmartInsertDeleteEnabled() {
+ return smart_insert_delete_enabled_;
+}
+
+bool TestWebViewDelegate::isSelectTrailingWhitespaceEnabled() {
+ return select_trailing_whitespace_enabled_;
}
-void TestWebViewDelegate::didStartLoading() {
+void TestWebViewDelegate::didBeginEditing() {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: "
+ "webViewDidBeginEditing:WebViewDidBeginEditingNotification\n");
+ }
}
-void TestWebViewDelegate::didStopLoading() {
+void TestWebViewDelegate::didChangeSelection(bool is_empty_selection) {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: "
+ "webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n");
+ }
+ UpdateSelectionClipboard(is_empty_selection);
+}
+
+void TestWebViewDelegate::didChangeContents() {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: "
+ "webViewDidChange:WebViewDidChangeNotification\n");
+ }
+}
+
+void TestWebViewDelegate::didEndEditing() {
+ if (shell_->ShouldDumpEditingCallbacks()) {
+ printf("EDITING DELEGATE: "
+ "webViewDidEndEditing:WebViewDidEndEditingNotification\n");
+ }
}
void TestWebViewDelegate::runModalAlertDialog(
@@ -381,13 +487,6 @@ void TestWebViewDelegate::setStatusText(const WebString& text) {
}
}
-void TestWebViewDelegate::setMouseOverURL(const WebURL& url) {
-}
-
-void TestWebViewDelegate::setToolTipText(
- const WebString& text, WebTextDirection hint) {
-}
-
void TestWebViewDelegate::startDragging(
const WebPoint& mouse_coords, const WebDragData& data,
WebDragOperationsMask mask) {
@@ -416,12 +515,6 @@ void TestWebViewDelegate::startDragging(
shell_->webView()->DragSourceSystemDragEnded();
}
-void TestWebViewDelegate::focusNext() {
-}
-
-void TestWebViewDelegate::focusPrevious() {
-}
-
void TestWebViewDelegate::navigateBackForwardSoon(int offset) {
shell_->navigation_controller()->GoToOffset(offset);
}
@@ -438,9 +531,6 @@ int TestWebViewDelegate::historyForwardListCount() {
return shell_->navigation_controller()->GetEntryCount() - current_index - 1;
}
-void TestWebViewDelegate::didAddHistoryItem() {
-}
-
// WebWidgetClient -----------------------------------------------------------
void TestWebViewDelegate::didInvalidateRect(const WebRect& rect) {
@@ -471,122 +561,6 @@ WebScreenInfo TestWebViewDelegate::screenInfo() {
return WebScreenInfo();
}
-// WebEditingClient ----------------------------------------------------------
-// The output from these methods in layout test mode should match that
-// expected by the layout tests. See EditingDelegate.m in DumpRenderTree.
-
-bool TestWebViewDelegate::shouldBeginEditing(const WebRange& range) {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n",
- GetRangeDescription(range).c_str());
- }
- return shell_->AcceptsEditing();
-}
-
-bool TestWebViewDelegate::shouldEndEditing(const WebRange& range) {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n",
- GetRangeDescription(range).c_str());
- }
- return shell_->AcceptsEditing();
-}
-
-bool TestWebViewDelegate::shouldInsertNode(const WebNode& node,
- const WebRange& range,
- WebEditingAction action) {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldInsertNode:%s "
- "replacingDOMRange:%s givenAction:%s\n",
- GetNodeDescription(node, 0).c_str(),
- GetRangeDescription(range).c_str(),
- GetEditingActionDescription(action).c_str());
- }
- return shell_->AcceptsEditing();
-}
-
-bool TestWebViewDelegate::shouldInsertText(const WebString& text,
- const WebRange& range,
- WebEditingAction action) {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldInsertText:%s "
- "replacingDOMRange:%s givenAction:%s\n",
- text.utf8().data(),
- GetRangeDescription(range).c_str(),
- GetEditingActionDescription(action).c_str());
- }
- return shell_->AcceptsEditing();
-}
-
-bool TestWebViewDelegate::shouldChangeSelectedRange(const WebRange& from_range,
- const WebRange& to_range,
- WebTextAffinity affinity,
- bool still_selecting) {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s "
- "toDOMRange:%s affinity:%s stillSelecting:%s\n",
- GetRangeDescription(from_range).c_str(),
- GetRangeDescription(to_range).c_str(),
- GetTextAffinityDescription(affinity).c_str(),
- (still_selecting ? "TRUE" : "FALSE"));
- }
- return shell_->AcceptsEditing();
-}
-
-bool TestWebViewDelegate::shouldDeleteRange(const WebRange& range) {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n",
- GetRangeDescription(range).c_str());
- }
- return shell_->AcceptsEditing();
-}
-
-bool TestWebViewDelegate::shouldApplyStyle(const WebString& style,
- const WebRange& range) {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n",
- style.utf8().data(),
- GetRangeDescription(range).c_str());
- }
- return shell_->AcceptsEditing();
-}
-
-bool TestWebViewDelegate::isSmartInsertDeleteEnabled() {
- return smart_insert_delete_enabled_;
-}
-
-bool TestWebViewDelegate::isSelectTrailingWhitespaceEnabled() {
- return select_trailing_whitespace_enabled_;
-}
-
-void TestWebViewDelegate::didBeginEditing() {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: "
- "webViewDidBeginEditing:WebViewDidBeginEditingNotification\n");
- }
-}
-
-void TestWebViewDelegate::didChangeSelection(bool is_empty_selection) {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: "
- "webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n");
- }
- UpdateSelectionClipboard(is_empty_selection);
-}
-
-void TestWebViewDelegate::didChangeContents() {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: "
- "webViewDidChange:WebViewDidChangeNotification\n");
- }
-}
-
-void TestWebViewDelegate::didEndEditing() {
- if (shell_->ShouldDumpEditingCallbacks()) {
- printf("EDITING DELEGATE: "
- "webViewDidEndEditing:WebViewDidEndEditingNotification\n");
- }
-}
-
// WebFrameClient ------------------------------------------------------------
WebPlugin* TestWebViewDelegate::createPlugin(
@@ -624,9 +598,6 @@ WebMediaPlayer* TestWebViewDelegate::createMediaPlayer(
return new webkit_glue::WebMediaPlayerImpl(client, factory);
}
-void TestWebViewDelegate::willClose(WebFrame* frame) {
-}
-
void TestWebViewDelegate::loadURLExternally(
WebFrame* frame, const WebURLRequest& request,
WebNavigationPolicy policy) {
@@ -658,10 +629,6 @@ WebNavigationPolicy TestWebViewDelegate::decidePolicyForNavigation(
return result;
}
-void TestWebViewDelegate::willSubmitForm(WebFrame* frame, const WebForm&) {
- // Ignore
-}
-
void TestWebViewDelegate::willPerformClientRedirect(
WebFrame* frame, const WebURL& from, const WebURL& to,
double interval, double fire_time) {
@@ -679,10 +646,6 @@ void TestWebViewDelegate::didCancelClientRedirect(WebFrame* frame) {
}
}
-void TestWebViewDelegate::didCompleteClientRedirect(
- WebFrame* frame, const WebURL& from) {
-}
-
void TestWebViewDelegate::didCreateDataSource(
WebFrame* frame, WebDataSource* ds) {
ds->setExtraData(pending_extra_data_.release());
@@ -751,12 +714,6 @@ void TestWebViewDelegate::didFailProvisionalLoad(
error_text, GURL("testshell-error:"), error.unreachableURL, replace);
}
-void TestWebViewDelegate::didReceiveDocumentData(
- WebFrame* frame, const char* data, size_t length,
- bool& preventDefault) {
- // Ignore
-}
-
void TestWebViewDelegate::didCommitProvisionalLoad(
WebFrame* frame, bool is_new_navigation) {
if (shell_->ShouldDumpFrameLoadCallbacks()) {
@@ -770,10 +727,6 @@ void TestWebViewDelegate::didClearWindowObject(WebFrame* frame) {
shell_->BindJSObjectsToWindow(frame);
}
-void TestWebViewDelegate::didCreateDocumentElement(WebFrame* frame) {
- // Ignore
-}
-
void TestWebViewDelegate::didReceiveTitle(
WebFrame* frame, const WebString& title) {
std::wstring wtitle = UTF16ToWideHack(title);
@@ -920,11 +873,6 @@ void TestWebViewDelegate::didFailResourceLoad(
resource_identifier_map_.erase(identifier);
}
-void TestWebViewDelegate::didLoadResourceFromMemoryCache(
- WebFrame* frame, const WebURLRequest&,
- const WebURLResponse&) {
-}
-
void TestWebViewDelegate::didDisplayInsecureContent(WebFrame* frame) {
if (shell_->ShouldDumpFrameLoadCallbacks())
printf("didDisplayInsecureContent\n");
@@ -936,14 +884,6 @@ void TestWebViewDelegate::didRunInsecureContent(
printf("didRunInsecureContent\n");
}
-void TestWebViewDelegate::didExhaustMemoryAvailableForScript(WebFrame* frame) {
-}
-
-void TestWebViewDelegate::didChangeContentsSize(
- WebFrame* frame, const WebSize&) {
-}
-
-
// Public methods ------------------------------------------------------------
TestWebViewDelegate::TestWebViewDelegate(TestShell* shell)