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

Side by Side Diff: chrome/test/functional/ispy/server/image_handler.py

Issue 106523003: [I-Spy] Add support for rebaselining expectations from the web UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing dom.py Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Request handler to display an image from Google Cloud Storage.""" 5 """Request handler to display an image from Google Cloud Storage."""
6 6
7 import json 7 import json
8 import os 8 import os
9 import sys 9 import sys
10 import webapp2 10 import webapp2
11 11
12 from ..common import cloud_bucket 12 from common import cloud_bucket
13 from ..common import constants 13 from common import constants
14 14
15 import gs_bucket 15 import gs_bucket
16 16
17 17
18 class ImageHandler(webapp2.RequestHandler): 18 class ImageHandler(webapp2.RequestHandler):
19 """A request handler to avoid the Same-Origin problem in the debug view.""" 19 """A request handler to avoid the Same-Origin problem in the debug view."""
20 20
21 def get(self): 21 def get(self):
22 """Handles get requests to the ImageHandler. 22 """Handles get requests to the ImageHandler.
23 23
24 GET Parameters: 24 GET Parameters:
25 file_path: A path to an image resource in Google Cloud Storage. 25 file_path: A path to an image resource in Google Cloud Storage.
26 """ 26 """
27 file_path = self.request.get('file_path') 27 file_path = self.request.get('file_path')
28 if not file_path: 28 if not file_path:
29 self.error(404) 29 self.error(404)
30 return 30 return
31 bucket = gs_bucket.GoogleCloudStorageBucket(constants.BUCKET) 31 bucket = gs_bucket.GoogleCloudStorageBucket(constants.BUCKET)
32 try: 32 try:
33 image = bucket.DownloadFile(file_path) 33 image = bucket.DownloadFile(file_path)
34 except cloud_bucket.FileNotFoundError: 34 except cloud_bucket.FileNotFoundError:
35 self.error(404) 35 self.error(404)
36 else: 36 else:
37 self.response.headers['Content-Type'] = 'image/png' 37 self.response.headers['Content-Type'] = 'image/png'
38 self.response.out.write(image) 38 self.response.out.write(image)
OLDNEW
« no previous file with comments | « chrome/test/functional/ispy/server/gs_bucket.py ('k') | chrome/test/functional/ispy/server/main_view_handler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698