summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authormorrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 12:04:27 +0000
committermorrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-24 12:04:27 +0000
commitab72751184f73239dbff7d9b24b6f67ffeb1c25b (patch)
treec0a0d7cec9fa89ee43abdf2cfe481fa8280ad58f /webkit/tools
parent5759e485e9b6990dc450dcd9868b825e61433f41 (diff)
downloadchromium_src-ab72751184f73239dbff7d9b24b6f67ffeb1c25b.zip
chromium_src-ab72751184f73239dbff7d9b24b6f67ffeb1c25b.tar.gz
chromium_src-ab72751184f73239dbff7d9b24b6f67ffeb1c25b.tar.bz2
Revert 67248 - TestShell: Backported EventSender.contextClick() improvement to mock menu item strings.
BUG=63460 TEST=LayoutTest/editing/spelling/context-menu-suggestions.html TBR=morrita@chromium.org Review URL: http://codereview.chromium.org/5120002 TBR=morrita@chromium.org Review URL: http://codereview.chromium.org/5363002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67251 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc55
-rw-r--r--webkit/tools/test_shell/mock_spellcheck.cc6
-rw-r--r--webkit/tools/test_shell/mock_spellcheck.h5
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc7
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h11
5 files changed, 0 insertions, 84 deletions
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc
index bb93775..6bf0282 100644
--- a/webkit/tools/test_shell/event_sending_controller.cc
+++ b/webkit/tools/test_shell/event_sending_controller.cc
@@ -35,7 +35,6 @@
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebTouchPoint.h"
#include "third_party/WebKit/WebKit/chromium/public/WebView.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebBindings.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/tools/test_shell/test_shell.h"
#include "webkit/tools/test_shell/test_webview_delegate.h"
@@ -771,60 +770,12 @@ void EventSendingController::ReplaySavedEvents() {
replaying_saved_events = false;
}
-// Because actual context menu is implemented by the browser side,
-// this function does only what LayoutTests are expecting:
-// - Many test checks the count of items. So returning non-zero value
-// makes sense.
-// - Some test compares the count before and after some action. So
-// changing the count based on flags also makes sense. This function
-// is doing such for some flags.
-// - Some test even checks actual string content. So providing it
-// would be also helpful.
-static std::vector<WebString>
-MakeMenuItemStringsFor(const WebKit::WebContextMenuData* context_menu,
- MockSpellCheck* spellcheck) {
- // These constants are based on Safari's context menu because tests
- // are made for it.
- static const char* kNonEditableMenuStrings[] = {
- "Back", "Reload Page", "Open in Dashbaord", "<separator>",
- "View Source", "Save Page As", "Print Page", "Inspect Element",
- 0 };
- static const char* kEditableMenuStrings[] = {
- "Cut", "Copy", "<separator>", "Paste", "Spelling and Grammar",
- "Substitutions, Transformations", "Font", "Speech",
- "Paragraph Direction", "<separator>", 0 };
-
- // This is possible because mouse events are cancelleable.
- if (!context_menu)
- return std::vector<WebString>();
-
- std::vector<WebString> strings;
-
- if (context_menu->isEditable) {
- for (const char** item = kEditableMenuStrings; *item; ++item)
- strings.push_back(WebString::fromUTF8(*item));
- std::vector<string16> suggestions;
- spellcheck->FillSuggestions(context_menu->misspelledWord, &suggestions);
- for (size_t i = 0; i < suggestions.size(); ++i)
- strings.push_back(WebString(suggestions[i]));
- } else {
- for (const char** item = kNonEditableMenuStrings; *item; ++item)
- strings.push_back(WebString::fromUTF8(*item));
- }
-
- return strings;
-}
-
void EventSendingController::contextClick(
const CppArgumentList& args, CppVariant* result) {
result->SetNull();
webview()->layout();
- // Clears last context menu data because we need to know if the
- // context menu be requested after following mouse events.
- shell_->delegate()->ClearContextMenuData();
-
UpdateClickCountForButton(WebMouseEvent::ButtonRight);
// Generate right mouse down and up.
@@ -840,12 +791,6 @@ void EventSendingController::contextClick(
webview()->handleInputEvent(event);
pressed_button_ = WebMouseEvent::ButtonNone;
-
- result->Set(WebKit::WebBindings::makeStringArray(
- MakeMenuItemStringsFor(
- shell_->delegate()->last_context_menu_data(),
- shell_->delegate()->mock_spellcheck())));
-
}
void EventSendingController::scheduleAsynchronousClick(
diff --git a/webkit/tools/test_shell/mock_spellcheck.cc b/webkit/tools/test_shell/mock_spellcheck.cc
index cc05c16..fd53401 100644
--- a/webkit/tools/test_shell/mock_spellcheck.cc
+++ b/webkit/tools/test_shell/mock_spellcheck.cc
@@ -125,9 +125,3 @@ bool MockSpellCheck::InitializeIfNeeded() {
// function always returns false.
return false;
}
-
-void MockSpellCheck::FillSuggestions(const string16& word,
- std::vector<string16>* suggestions) {
- if (word == ASCIIToUTF16("wellcome"))
- suggestions->push_back(ASCIIToUTF16("welcome"));
-}
diff --git a/webkit/tools/test_shell/mock_spellcheck.h b/webkit/tools/test_shell/mock_spellcheck.h
index 41b180d..0f40675 100644
--- a/webkit/tools/test_shell/mock_spellcheck.h
+++ b/webkit/tools/test_shell/mock_spellcheck.h
@@ -6,7 +6,6 @@
#define WEBKIT_TOOLS_TEST_SHELL_MOCK_SPELLCHECK_H_
#include <map>
-#include <vector>
#include "base/string16.h"
@@ -33,10 +32,6 @@ class MockSpellCheck {
int* misspelledOffset,
int* misspelledLength);
- // Emulates suggestions for misspelled words.
- // The suggestions are pushed to |suggestions| parameters.
- void FillSuggestions(const string16& word,
- std::vector<string16>* suggestions);
private:
// Initialize the internal resources if we need to initialize it.
// Initializing this object may take long time. To prevent from hurting
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 4ad7349..c623afe 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -578,15 +578,8 @@ void TestWebViewDelegate::showContextMenu(
data.mousePosition.x,
data.mousePosition.y);
captured_context_menu_events_.push_back(context);
- last_context_menu_data_.reset(new WebContextMenuData(data));
}
-void TestWebViewDelegate::ClearContextMenuData() {
- last_context_menu_data_.reset();
-}
-
-
-
void TestWebViewDelegate::setStatusText(const WebString& text) {
if (WebKit::layoutTestMode() &&
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 3c7f38d..c63cb9f 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -325,16 +325,6 @@ class TestWebViewDelegate : public WebKit::WebViewClient,
void SetGeolocationPermission(bool allowed);
- void ClearContextMenuData();
-
- const WebKit::WebContextMenuData* last_context_menu_data() const {
- return last_context_menu_data_.get();
- }
-
- MockSpellCheck* mock_spellcheck() {
- return &mock_spellcheck_;
- }
-
private:
// Called the title of the page changes.
@@ -412,7 +402,6 @@ class TestWebViewDelegate : public WebKit::WebViewClient,
std::string GetResourceDescription(uint32 identifier);
CapturedContextMenuEvents captured_context_menu_events_;
- scoped_ptr<WebKit::WebContextMenuData> last_context_menu_data_;
WebCursor current_cursor_;