summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornags <nags@nags-desktop.(none)>2009-08-11 20:37:18 -0700
committernags <nags@nags-desktop.(none)>2009-08-11 20:37:18 -0700
commitf2032898c3804bee080f0b556c068297347af8d6 (patch)
tree4f549ed3a682a621f768b2e036dc192146b3f7aa
parent479ef9ae953fc39110859e0cca7af0b61a905d78 (diff)
2009-08-11 Nagappan Alagappan <nagappan@gmail.com>
* ldtp.py (windowuptime): Fixes bug 587614, Method to measure how long a window is showing up.
-rw-r--r--python/ChangeLog5
-rw-r--r--python/ldtp.py28
-rw-r--r--python/ldtplib/ldtplibutils.py1
3 files changed, 34 insertions, 0 deletions
diff --git a/python/ChangeLog b/python/ChangeLog
index eb693ad..fb889ba 100644
--- a/python/ChangeLog
+++ b/python/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-11 Nagappan Alagappan <nagappan@gmail.com>
+
+ * ldtp.py (windowuptime): Fixes bug 587614, Method to measure how
+ long a window is showing up.
+
2009-07-30 Nagappan Alagappan <nagappan@gmail.com>
* ldtp.py (doesrowexist): Fixes bug 588674, It would be nice if
diff --git a/python/ldtp.py b/python/ldtp.py
index 6ab97d1..8ea24d5 100644
--- a/python/ldtp.py
+++ b/python/ldtp.py
@@ -49,6 +49,7 @@ import thread
import commands
import traceback
import threading
+import datetime
from xml.sax import saxutils
from xml.parsers.expat import ExpatError
from xml.dom.minidom import parse, parseString
@@ -3808,3 +3809,30 @@ def verifyprogressbarvisible (windowName, componentName):
except LdtpExecutionError:
return 0
+def windowuptime(windowName):
+ """
+ INPUT: windowuptime('<window name>')
+
+ OUTPUT: start time, end time on success, LdtpExecutionError on failure"""
+ try:
+ _requestId = threading.currentThread().getName() + str(command.WINDOWUPTIME)
+ _message = generatexml(command.WINDOWUPTIME, _requestId, windowName)
+ sendpacket(_message)
+ _responseStatus, _responseData = getresponse(_requestId)
+ if _responseStatus [0] != 0:
+ raise LdtpExecutionError (_responseStatus [1])
+ if not _responseData[1]:
+ raise LdtpExecutionError("Window '%s' never poped up" % windowName)
+ tmpTime = _responseData[1].split('-')
+ endTime = tmpTime[0].split(' ')
+ startTime = tmpTime[1].split(' ')
+ _startTime = datetime.datetime(int(startTime[0]), int(startTime[1]),
+ int(startTime[2]), int(startTime[3]),
+ int(startTime[4]), int(startTime[5]))
+ _endTime = datetime.datetime(int(endTime[0]), int(endTime[1]),
+ int(endTime[2]),int(endTime[3]),
+ int(endTime[4]), int(endTime[5]))
+ return _startTime, _endTime
+ except LdtpExecutionError, msg:
+ logFailures ('windowuptime failed: %s' % msg.value)
+ raise
diff --git a/python/ldtplib/ldtplibutils.py b/python/ldtplib/ldtplibutils.py
index fad8dab..5ff8fe6 100644
--- a/python/ldtplib/ldtplibutils.py
+++ b/python/ldtplib/ldtplibutils.py
@@ -240,6 +240,7 @@ class command:
VERIFYVISIBLEBUTTONCOUNT = index; index += 1
WAITTILLGUIEXIST = index; index += 1
WAITTILLGUINOTEXIST = index; index += 1
+ WINDOWUPTIME = index; index += 1
class state:
"""