Index: native_client_sdk/src/build_tools/screenshot_extension/README |
diff --git a/native_client_sdk/src/build_tools/screenshot_extension/README b/native_client_sdk/src/build_tools/screenshot_extension/README |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c1f505ed3bd38492e71085980f920c220b993e7 |
--- /dev/null |
+++ b/native_client_sdk/src/build_tools/screenshot_extension/README |
@@ -0,0 +1,33 @@ |
+Screenshot Extension |
+-------------------- |
+ |
+This extension is to visually test the SDK examples. To use, add this to the |
+html: |
+ |
+TODO(binji): normal users shouldn't have to do this -- it should be |
+automatically loaded by the testing framework. |
+ |
+ <head> |
+ ... |
+ <script |
+ src="chrome-extension://kbbhhngcmjcmlgcnbihfgliliemmijmj/screenshot.js"> |
+ </script> |
+ <head> |
+ |
+Then in JavaScript: |
+ |
+ var myPluginEl = document.embeds[0]; |
+ function onSuccess(dataURL) { |
+ // dataURL is a data URL encoded PNG. You can add this to a image like this: |
+ var image = new Image(); |
+ image.onload = function() { ... } |
+ image.src = dataURL; |
+ } |
+ |
+ function onError(errorMessage) { |
+ ... |
+ } |
+ |
+ screenshot.captureElement(myPluginEl, onSuccess, onError); |
+ |
+See screenshot.js for more info on the API. |