Bug 818287 Remove data URL prefix from screenshots. r=dhunt

This commit is contained in:
Sebastiaan de Haan 2013-11-08 07:27:00 +00:00
Родитель 0116c0bdb4
Коммит bd107b0e67
2 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -7,19 +7,19 @@ class ScreenshotTests(MarionetteTestCase):
test_url = self.marionette.absolute_url('html5Page.html')
self.marionette.navigate(test_url)
el = self.marionette.find_element('id', 'red')
self.assertEqual('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAVUlEQVRoge3PsQ0AIAzAsI78fzBwBhHykD2ePev80LweAAGJB1ILpBZILZBaILVAaoHUAqkFUgukFkgtkFogtUBqgdQCqQVSC6QWSC2QWiC1QGp9A7ma+7nyXgOpzQAAAABJRU5ErkJggg==',
self.assertEqual('iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAVUlEQVRoge3PsQ0AIAzAsI78fzBwBhHykD2ePev80LweAAGJB1ILpBZILZBaILVAaoHUAqkFUgukFkgtkFogtUBqgdQCqQVSC6QWSC2QWiC1QGp9A7ma+7nyXgOpzQAAAABJRU5ErkJggg==',
self.marionette.screenshot(element=el))
def testWeCanTakeAScreenShotWithHighlightOfAnElement(self):
test_url = self.marionette.absolute_url('html5Page.html')
self.marionette.navigate(test_url)
el = self.marionette.find_element('id', 'green')
self.assertEqual('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAV0lEQVRoge3PQRGAQAwAsWINvXgsNnI3+4iAzM7sDWZn9vneoxXRFNEU0RTRFNEU0RTRFNEU0RTRFNEU0RTRFNEU0RTRFNEU0RTRFNEU0RTRFNHcF7nBD/Ha5Ye4BbsYAAAAAElFTkSuQmCC',
self.assertEqual('iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAV0lEQVRoge3PQRGAQAwAsWINvXgsNnI3+4iAzM7sDWZn9vneoxXRFNEU0RTRFNEU0RTRFNEU0RTRFNEU0RTRFNEU0RTRFNEU0RTRFNEU0RTRFNHcF7nBD/Ha5Ye4BbsYAAAAAElFTkSuQmCC',
self.marionette.screenshot(element=el, highlights=[el]))
def testWeCanTakeAScreenShotEntireCanvas(self):
test_url = self.marionette.absolute_url('html5Page.html')
self.marionette.navigate(test_url)
self.assertTrue('data:image/png;base64,iVBORw0KGgo' in
self.assertTrue('iVBORw0KGgo' in
self.marionette.screenshot())

Просмотреть файл

@ -1937,7 +1937,8 @@ function screenShot(msg) {
// Return the Base64 String back to the client bindings and they can manage
// saving the file to disk if it is required
sendResponse({value:canvas.toDataURL("image/png","")}, msg.json.command_id);
var data_url = canvas.toDataURL("image/png","");
sendResponse({value: data_url.substring(data_url.indexOf(",") + 1)}, msg.json.command_id);
}
//call register self when we get loaded