application_cache.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Licensed to the Software Freedom Conservancy (SFC) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The SFC licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing,
  12. # software distributed under the License is distributed on an
  13. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. # KIND, either express or implied. See the License for the
  15. # specific language governing permissions and limitations
  16. # under the License.
  17. """
  18. The ApplicationCache implementaion.
  19. """
  20. from selenium.webdriver.remote.command import Command
  21. class ApplicationCache(object):
  22. UNCACHED = 0
  23. IDLE = 1
  24. CHECKING = 2
  25. DOWNLOADING = 3
  26. UPDATE_READY = 4
  27. OBSOLETE = 5
  28. def __init__(self, driver):
  29. """
  30. Creates a new Aplication Cache.
  31. :Args:
  32. - driver: The WebDriver instance which performs user actions.
  33. """
  34. self.driver = driver
  35. @property
  36. def status(self):
  37. """
  38. Returns a current status of application cache.
  39. """
  40. return self.driver.execute(Command.GET_APP_CACHE_STATUS)['value']