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

Unified Diff: build/android/pylib/device/device_utils_test.py

Issue 1040473002: [android] Create Battery Utils to seperate power functionality (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « build/android/pylib/device/device_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/device_utils_test.py
diff --git a/build/android/pylib/device/device_utils_test.py b/build/android/pylib/device/device_utils_test.py
index 98e35392b92d3d64d3d79b98eb940da7f7ff2d1e..14aef954a9aaf62fac2d60b90e4cd3df537089c0 100755
--- a/build/android/pylib/device/device_utils_test.py
+++ b/build/android/pylib/device/device_utils_test.py
@@ -1590,6 +1590,32 @@ class DeviceUtilsParallelTest(mock_calls.TestCase):
device_utils.DeviceUtils.parallel()
+class DeviceUtilsClientCache(DeviceUtilsTest):
+
+ def testClientCache_twoCaches(self):
+ self.device._cache['test'] = 0
+ client_cache_one = self.device.GetClientCache('ClientOne')
+ client_cache_one['test'] = 1
+ client_cache_two = self.device.GetClientCache('ClientTwo')
+ client_cache_two['test'] = 2
+ self.assertEqual(self.device._cache, {'test': 0})
+ self.assertEqual(client_cache_one, {'test': 1})
+ self.assertEqual(client_cache_two, {'test': 2})
+ self.device._ClearCache()
+ self.assertEqual(self.device._cache, {})
+ self.assertEqual(client_cache_one, {})
+ self.assertEqual(client_cache_two, {})
+
+ def testClientCache_multipleInstances(self):
+ client_cache_one = self.device.GetClientCache('ClientOne')
+ client_cache_one['test'] = 1
+ client_cache_two = self.device.GetClientCache('ClientOne')
+ self.assertEqual(client_cache_one, {'test': 1})
+ self.assertEqual(client_cache_two, {'test': 1})
+ self.device._ClearCache()
+ self.assertEqual(client_cache_one, {})
+ self.assertEqual(client_cache_two, {})
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.DEBUG)
unittest.main(verbosity=2)
« no previous file with comments | « build/android/pylib/device/device_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698