Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1107)

Unified Diff: Source/web/tests/WebViewTest.cpp

Issue 464613003: WebView unit tests for Defect 248426 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed typo Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698