Index: Source/web/tests/WebViewTest.cpp |
diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp |
index 502c90288406941958972a9872270334c6d5ce22..60412214a20869c4c3eec9d6220a201af0d8c046 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(exptected, actual); |
jamesr
2014/08/13 19:07:48
typo 'exptected' -> 'expected'
|
+} |
+ |
} // namespace |