| OLD | NEW |
| 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 allow test mask updates.""" | 5 """Request Handler to allow test mask updates.""" |
| 6 | 6 |
| 7 import webapp2 | 7 import webapp2 |
| 8 import re | 8 import re |
| 9 import sys | 9 import sys |
| 10 import os | 10 import os |
| 11 | 11 |
| 12 from ..common import constants | 12 from common import constants |
| 13 from ..common import image_tools | 13 from common import image_tools |
| 14 from ..common import ispy_utils | 14 from common import ispy_utils |
| 15 | 15 |
| 16 import gs_bucket | 16 import gs_bucket |
| 17 | 17 |
| 18 | 18 |
| 19 class UpdateMaskHandler(webapp2.RequestHandler): | 19 class UpdateMaskHandler(webapp2.RequestHandler): |
| 20 """Request handler to allow test mask updates.""" | 20 """Request handler to allow test mask updates.""" |
| 21 | 21 |
| 22 def post(self): | 22 def post(self): |
| 23 """Accepts post requests. | 23 """Accepts post requests. |
| 24 | 24 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 50 # Get the failure namedtuple (which also computes the diff). | 50 # Get the failure namedtuple (which also computes the diff). |
| 51 failure = self.ispy.GetFailure(test_run, expectation) | 51 failure = self.ispy.GetFailure(test_run, expectation) |
| 52 # Upload the new mask in place of the original. | 52 # Upload the new mask in place of the original. |
| 53 self.ispy.UpdateImage( | 53 self.ispy.UpdateImage( |
| 54 ispy_utils.GetExpectationPath(expectation, 'mask.png'), | 54 ispy_utils.GetExpectationPath(expectation, 'mask.png'), |
| 55 image_tools.ConvertDiffToMask(failure.diff)) | 55 image_tools.ConvertDiffToMask(failure.diff)) |
| 56 # Now that there is no diff for the two images, remove the failure. | 56 # Now that there is no diff for the two images, remove the failure. |
| 57 self.ispy.RemoveFailure(test_run, expectation) | 57 self.ispy.RemoveFailure(test_run, expectation) |
| 58 # Redirect back to the sites list for the test run. | 58 # Redirect back to the sites list for the test run. |
| 59 self.redirect('/?test_run=%s' % test_run) | 59 self.redirect('/?test_run=%s' % test_run) |
| OLD | NEW |