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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "public/web/WebAutofillClient.h" 59 #include "public/web/WebAutofillClient.h"
60 #include "public/web/WebContentDetectionResult.h" 60 #include "public/web/WebContentDetectionResult.h"
61 #include "public/web/WebDateTimeChooserCompletion.h" 61 #include "public/web/WebDateTimeChooserCompletion.h"
62 #include "public/web/WebDocument.h" 62 #include "public/web/WebDocument.h"
63 #include "public/web/WebDragOperation.h" 63 #include "public/web/WebDragOperation.h"
64 #include "public/web/WebElement.h" 64 #include "public/web/WebElement.h"
65 #include "public/web/WebFrame.h" 65 #include "public/web/WebFrame.h"
66 #include "public/web/WebFrameClient.h" 66 #include "public/web/WebFrameClient.h"
67 #include "public/web/WebHitTestResult.h" 67 #include "public/web/WebHitTestResult.h"
68 #include "public/web/WebInputEvent.h" 68 #include "public/web/WebInputEvent.h"
69 #include "public/web/WebScriptSource.h"
69 #include "public/web/WebSettings.h" 70 #include "public/web/WebSettings.h"
70 #include "public/web/WebViewClient.h" 71 #include "public/web/WebViewClient.h"
71 #include "public/web/WebWidget.h" 72 #include "public/web/WebWidget.h"
72 #include "public/web/WebWidgetClient.h" 73 #include "public/web/WebWidgetClient.h"
73 #include "third_party/skia/include/core/SkBitmap.h" 74 #include "third_party/skia/include/core/SkBitmap.h"
74 #include "third_party/skia/include/core/SkBitmapDevice.h" 75 #include "third_party/skia/include/core/SkBitmapDevice.h"
75 #include "third_party/skia/include/core/SkCanvas.h" 76 #include "third_party/skia/include/core/SkCanvas.h"
76 #include "web/WebLocalFrameImpl.h" 77 #include "web/WebLocalFrameImpl.h"
77 #include "web/WebSettingsImpl.h" 78 #include "web/WebSettingsImpl.h"
78 #include "web/WebViewImpl.h" 79 #include "web/WebViewImpl.h"
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 webView->setInitialFocus(false); 2131 webView->setInitialFocus(false);
2131 2132
2132 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); 2133 EXPECT_EQ(0, client.getUserGestureNotificationsCount());
2133 2134
2134 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); 2135 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target")));
2135 2136
2136 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); 2137 EXPECT_EQ(1, client.getUserGestureNotificationsCount());
2137 webView->setAutofillClient(0); 2138 webView->setAutofillClient(0);
2138 } 2139 }
2139 2140
2141 TEST_F(WebViewTest, CompareSelectAllToContentAsText)
2142 {
2143 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("longpress_selection.html"));
2144 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_ selection.html", true);
2145
2146 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
2147 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma nd('SelectAll', false, null)")));
2148 std::string actual = frame->selectionAsText().utf8();
2149
2150 const int kMaxOutputCharacters = 1024;
2151 std::string expected = frame->contentAsText(kMaxOutputCharacters).utf8();
2152 EXPECT_EQ(expected, actual);
2153 }
2154
2140 } // namespace 2155 } // namespace
OLDNEW
« 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