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

Unified Diff: chrome/test/functional/ispy/server/gs_bucket.py

Issue 222873002: Remove pyauto tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 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
Index: chrome/test/functional/ispy/server/gs_bucket.py
===================================================================
--- chrome/test/functional/ispy/server/gs_bucket.py (revision 261231)
+++ chrome/test/functional/ispy/server/gs_bucket.py (working copy)
@@ -1,72 +0,0 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Implementation of CloudBucket using Google Cloud Storage as the backend."""
-import os
-import sys
-
-import cloudstorage
-
-from common import cloud_bucket
-
-
-class GoogleCloudStorageBucket(cloud_bucket.BaseCloudBucket):
- """Subclass of cloud_bucket.CloudBucket with actual GS commands."""
-
- def __init__(self, bucket):
- """Initializes the bucket.
-
- Args:
- bucket: the name of the bucket to connect to.
- """
- self.bucket = '/' + bucket
-
- def _full_path(self, path):
- return self.bucket + '/' + path.lstrip('/')
-
- # override
- def UploadFile(self, path, contents, content_type):
- gs_file = cloudstorage.open(
- self._full_path(path), 'w', content_type=content_type)
- gs_file.write(contents)
- gs_file.close()
-
- # override
- def DownloadFile(self, path):
- try:
- gs_file = cloudstorage.open(self._full_path(path), 'r')
- r = gs_file.read()
- gs_file.close()
- except Exception as e:
- raise Exception('%s: %s' % (self._full_path(path), str(e)))
- return r
-
- # override
- def UpdateFile(self, path, contents):
- if not self.FileExists(path):
- raise cloud_bucket.FileNotFoundError
- gs_file = cloudstorage.open(self._full_path(path), 'w')
- gs_file.write(contents)
- gs_file.close()
-
- # override
- def RemoveFile(self, path):
- cloudstorage.delete(self._full_path(path))
-
- # override
- def FileExists(self, path):
- try:
- cloudstorage.stat(self._full_path(path))
- except cloudstorage.NotFoundError:
- return False
- return True
-
- # override
- def GetImageURL(self, path):
- return '/image?file_path=%s' % path
-
- # override
- def GetAllPaths(self, prefix):
- return (f.filename[len(self.bucket) + 1:] for f in
- cloudstorage.listbucket(self.bucket, prefix=prefix))
« no previous file with comments | « chrome/test/functional/ispy/server/debug_view_handler.py ('k') | chrome/test/functional/ispy/server/image_handler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698