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

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

Issue 270613004: Implement "Copy image" for canvas (blink side). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed nits Created 6 years, 6 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 | « Source/web/ContextMenuClientImpl.cpp ('k') | Source/web/tests/data/canvas-copy-image.html » ('j') | 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 0e0624206f2fe06a080853034965881ea0f983bd..3f78a94caa20cdfcf7d18c73c1adee3bb355adeb 100644
--- a/Source/web/tests/WebViewTest.cpp
+++ b/Source/web/tests/WebViewTest.cpp
@@ -49,6 +49,7 @@
#include "platform/geometry/IntSize.h"
#include "platform/graphics/Color.h"
#include "public/platform/Platform.h"
+#include "public/platform/WebClipboard.h"
#include "public/platform/WebDragData.h"
#include "public/platform/WebSize.h"
#include "public/platform/WebThread.h"
@@ -214,6 +215,21 @@ protected:
FrameTestHelpers::WebViewHelper m_webViewHelper;
};
+TEST_F(WebViewTest, CopyImageAt)
+{
+ std::string url = m_baseURL + "canvas-copy-image.html";
+ URLTestHelpers::registerMockedURLLoad(toKURL(url), "canvas-copy-image.html");
+ WebView* webView = m_webViewHelper.initializeAndLoad(url, true, 0);
+ webView->resize(WebSize(400, 400));
+ webView->copyImageAt(WebPoint(50, 50));
+
+ blink::WebData data = blink::Platform::current()->clipboard()->readImage(blink::WebClipboard::Buffer());
+ blink::WebImage image = blink::WebImage::fromData(data, WebSize());
+
+ SkAutoLockPixels autoLock(image.getSkBitmap());
+ EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.getSkBitmap().getColor(0, 0));
+};
+
TEST_F(WebViewTest, SetBaseBackgroundColor)
{
const WebColor kWhite = 0xFFFFFFFF;
« no previous file with comments | « Source/web/ContextMenuClientImpl.cpp ('k') | Source/web/tests/data/canvas-copy-image.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698