| Index: Source/web/tests/WebViewTest.cpp
|
| diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp
|
| index 502c90288406941958972a9872270334c6d5ce22..4c6e3e12a3e053b772da23e7dbf51ca56da88b53 100644
|
| --- a/Source/web/tests/WebViewTest.cpp
|
| +++ b/Source/web/tests/WebViewTest.cpp
|
| @@ -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"
|
| @@ -2137,4 +2138,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
|
|
|