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

Unified Diff: extensions/test/data/web_view/apitest/main.js

Issue 1582053002: Implement webview.captureVisibleRegion() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
Index: extensions/test/data/web_view/apitest/main.js
diff --git a/extensions/test/data/web_view/apitest/main.js b/extensions/test/data/web_view/apitest/main.js
index 983212cc0910060ed74a200278aba3129f50e490..4eda2138c3a467abbb9e12bdb25dc6dba247b88b 100644
--- a/extensions/test/data/web_view/apitest/main.js
+++ b/extensions/test/data/web_view/apitest/main.js
@@ -1685,6 +1685,28 @@ function testWebRequestAPIGoogleProperty() {
document.body.appendChild(webview);
}
+// This is a basic test to verify that image data is returned by
+// captureVisibleRegion().
+function testCaptureVisibleRegion() {
+ var webview = document.createElement('webview');
+ webview.src = 'data:text/html,webview test';
+
+ webview.addEventListener('loadstop', function(e) {
+ webview.captureVisibleRegion({}, function(imgdata) {
+ if (chrome.runtime.lastError) {
+ console.log('webview.apitest.testCaptureVisibleRegion: ' +
+ chrome.runtime.lastError.message);
+ embedder.test.fail();
+ } else {
+ embedder.test.assertTrue(
+ imgdata.indexOf('data:image/jpeg;base64') == 0);
+ embedder.test.succeed();
+ }
+ });
+ });
+ document.body.appendChild(webview);
+}
+
// Tests end.
embedder.test.testList = {
@@ -1752,7 +1774,8 @@ embedder.test.testList = {
'testWebRequestAPI': testWebRequestAPI,
'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders,
'testWebRequestAPIExistence': testWebRequestAPIExistence,
- 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty
+ 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty,
+ 'testCaptureVisibleRegion' : testCaptureVisibleRegion
};
onload = function() {

Powered by Google App Engine
This is Rietveld 408576698