diff options
author | frankf@google.com <frankf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-03 23:11:24 +0000 |
---|---|---|
committer | frankf@google.com <frankf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-03 23:11:24 +0000 |
commit | d5a69a528af282fe1aaeeafac1956cc384619dc7 (patch) | |
tree | e12ee253ea279129aa023975da8578ef0b0dd798 /chrome/test/pyautolib | |
parent | 8b788ef8c6b6e4e5fadece11a0db2d1973db5114 (diff) | |
download | chromium_src-d5a69a528af282fe1aaeeafac1956cc384619dc7.zip chromium_src-d5a69a528af282fe1aaeeafac1956cc384619dc7.tar.gz chromium_src-d5a69a528af282fe1aaeeafac1956cc384619dc7.tar.bz2 |
Add a function to file manager's pyautoAPI for getting disk size stats
BUG=chromiumos:19851
TEST=Ran pyauto tests
Change-Id: Iaa995cc1931e427117a70f4483cc89ef9fb26b9b
Review URL: http://codereview.chromium.org/8068012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103812 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/pyautolib')
-rw-r--r-- | chrome/test/pyautolib/chromeos/file_browser.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/chrome/test/pyautolib/chromeos/file_browser.py b/chrome/test/pyautolib/chromeos/file_browser.py index 112958a..f1892e4 100644 --- a/chrome/test/pyautolib/chromeos/file_browser.py +++ b/chrome/test/pyautolib/chromeos/file_browser.py @@ -3,6 +3,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import simplejson as json # found in third_party + class FileBrowser(object): """This class provides an API for automating the ChromeOS File Browser. @@ -51,11 +53,8 @@ class FileBrowser(object): script = """ pyautoAPI.listDirectory(); """ - list = self.executor.Execute(script) - if list: - return set(list.split('|')) - else: - return None + list = json.loads(self.executor.Execute(script)) + return set(list) def Save(self, name): """Save the entry using the given name. @@ -150,6 +149,18 @@ class FileBrowser(object): """ return self.executor.Execute(script) + def GetSelectedDirectorySizeStats(self): + """Get remaining and total size of selected directory. + + Returns: + A tuple: (remaining size in KB, total size in KB) + """ + script = """ + pyautoAPI.getSelectedDirectorySizeStats(); + """ + stats = json.loads(self.executor.Execute(script)) + return stats['remainingSizeKB'], stats['totalSizeKB'] + def WaitUntilInitialized(self): """Returns whether the file manager is initialized. |