The objective of this test to assert text returned from a SelectAll call on...

The objective of this test to assert text returned from a SelectAll call on WebContent is same as text from WebLocalFrame::ContentAsText.

This is a patch that refers to the following CL
https://codereview.chromium.org/342143004/

Review URL: https://codereview.chromium.org/464613003

git-svn-id: svn://svn.chromium.org/blink/trunk@180208 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a74b4366
......@@ -66,6 +66,7 @@
#include "public/web/WebFrameClient.h"
#include "public/web/WebHitTestResult.h"
#include "public/web/WebInputEvent.h"
#include "public/web/WebScriptSource.h"
#include "public/web/WebSettings.h"
#include "public/web/WebViewClient.h"
#include "public/web/WebWidget.h"
......@@ -2140,4 +2141,18 @@ TEST_F(WebViewTest, FirstUserGestureObservedGestureTap)
webView->setAutofillClient(0);
}
TEST_F(WebViewTest, CompareSelectAllToContentAsText)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_selection.html"));
WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_selection.html", true);
WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execCommand('SelectAll', false, null)")));
std::string actual = frame->selectionAsText().utf8();
const int kMaxOutputCharacters = 1024;
std::string expected = frame->contentAsText(kMaxOutputCharacters).utf8();
EXPECT_EQ(expected, actual);
}
} // namespace
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment