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..d041b835612347cc042f7db80fdeae61b34304f8 100644 |
--- a/extensions/test/data/web_view/apitest/main.js |
+++ b/extensions/test/data/web_view/apitest/main.js |
@@ -1685,6 +1685,37 @@ 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.setAttribute('src', 'data:text/html,webview test'); |
+ |
+ webview.addEventListener('loadstop', function(e) { |
+ window.captureVisibleRegionDoCapture = function() { |
+ webview.captureVisibleRegion({}, function(imgdata) { |
+ if (chrome.runtime.lastError) { |
+ console.log('webview.apitest.testCaptureVisibleRegion: ' + |
+ chrome.runtime.lastError.message); |
+ embedder.test.fail(); |
+ } else { |
+ if (imgdata.indexOf('data:image/jpeg;base64') != 0) { |
+ console_log('imgdata = ' + imgdata); |
+ } |
+ embedder.test.assertTrue( |
+ imgdata.indexOf('data:image/jpeg;base64') == 0); |
+ embedder.test.succeed(); |
+ } |
+ }); |
+ }; |
+ chrome.test.sendMessage('guest-loaded'); |
+ }); |
+ document.body.appendChild(webview); |
+} |
+ |
+function captureVisibleRegionDoCapture() { |
+} |
+ |
// Tests end. |
embedder.test.testList = { |
@@ -1752,7 +1783,8 @@ embedder.test.testList = { |
'testWebRequestAPI': testWebRequestAPI, |
'testWebRequestAPIWithHeaders': testWebRequestAPIWithHeaders, |
'testWebRequestAPIExistence': testWebRequestAPIExistence, |
- 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty |
+ 'testWebRequestAPIGoogleProperty': testWebRequestAPIGoogleProperty, |
+ 'testCaptureVisibleRegion' : testCaptureVisibleRegion |
}; |
onload = function() { |