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

Unified Diff: tests/selenium/selenium_utilities.py

Issue 164130: This CL adds client.toDataURL which gets the contents... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 4 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 | « tests/build.scons ('k') | utils/build.scons » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/selenium/selenium_utilities.py
===================================================================
--- tests/selenium/selenium_utilities.py (revision 22687)
+++ tests/selenium/selenium_utilities.py (working copy)
@@ -39,6 +39,7 @@
import re
import time
import unittest
+import base64
import gflags
import selenium_constants
@@ -174,8 +175,9 @@
full_path = filename.replace("\\", "/")
# Attempt to take a screenshot of the display buffer
- eval_string = ("%s.saveScreen('%s')" % (client, full_path))
+ eval_string = ("%s.toDataURL()" % client)
+
# Set Post render call back to take screenshot
script = ["window.g_selenium_post_render = false;",
"window.g_selenium_save_screen_result = false;",
@@ -196,9 +198,13 @@
session.wait_for_condition("window.g_selenium_post_render", 20000)
# Get result
- success = session.get_eval("window.g_selenium_save_screen_result")
-
- if success == u"true":
+ data_url = session.get_eval("window.g_selenium_save_screen_result")
+ expected_header = "data:image/png;base64,"
+ if data_url.startswith(expected_header):
+ png = base64.b64decode(data_url[len(expected_header):])
+ file = open(full_path + ".png", 'wb')
+ file.write(png)
+ file.close()
print "Saved screenshot %s." % full_path
return True
« no previous file with comments | « tests/build.scons ('k') | utils/build.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698