Allow only one bookmark to be added for multiple fast starring
[chromium-blink-merge.git] / chrome / test / ispy / server / debug_view_handler.py
blob96bfe3cff1b2493961c589fcda07bb5d4c874c6b
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
3 # found in the LICENSE file.
5 """Request handler to display the debug view for a Failure."""
7 import jinja2
8 import os
9 import sys
10 import webapp2
12 from common import ispy_utils
14 import views
16 JINJA = jinja2.Environment(
17 loader=jinja2.FileSystemLoader(os.path.dirname(views.__file__)),
18 extensions=['jinja2.ext.autoescape'])
21 class DebugViewHandler(webapp2.RequestHandler):
22 """Request handler to display the debug view for a failure."""
24 def get(self):
25 """Handles get requests to the /debug_view page.
27 GET Parameters:
28 test_run: The test run.
29 expectation: The expectation name.
30 """
31 test_run = self.request.get('test_run')
32 expectation = self.request.get('expectation')
33 expected_path = ispy_utils.GetExpectationPath(expectation, 'expected.png')
34 actual_path = ispy_utils.GetFailurePath(test_run, expectation, 'actual.png')
35 data = {}
37 def _ImagePath(url):
38 return '/image?file_path=%s' % url
40 data['expected'] = _ImagePath(expected_path)
41 data['actual'] = _ImagePath(actual_path)
42 data['test_run'] = test_run
43 data['expectation'] = expectation
44 template = JINJA.get_template('debug_view.html')
45 self.response.write(template.render(data))