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

Unified Diff: chrome/test/functional/ispy/server/rebaseline_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: Created 7 years 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/rebaseline_handler.py
diff --git a/chrome/test/functional/ispy/server/rebaseline_handler.py b/chrome/test/functional/ispy/server/rebaseline_handler.py
new file mode 100644
index 0000000000000000000000000000000000000000..2ab314b0a2f7d938f144874ac7dc0d5765b34207
--- /dev/null
+++ b/chrome/test/functional/ispy/server/rebaseline_handler.py
@@ -0,0 +1,44 @@
+# 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.
+
+"""Request Handler that updates the Expectation version."""
+
+import webapp2
+
+from common import constants
+from common import chrome_utils
+
+import gs_bucket
+
+
+class RebaselineHandler(webapp2.RequestHandler):
+ """Request handler to allow test mask updates."""
+
+ def post(self):
+ """Accepts post requests.
+
+ Expects a test_run as a parameter and updates the associated version file to
+ use the expectations associated with that test run.
+ """
+ test_run = self.request.get('test_run')
+
+ # Fail if test_run parameter is missing.
+ if not test_run:
+ self.response.header['Content-Type'] = 'json/application'
+ self.response.write(json.dumps(
+ {'error': '\'test_run\' must be supplied to rebaseline.'}))
+ return
+ # Otherwise, set up the utilities.
+ bucket = gs_bucket.GoogleCloudStorageBucket(constants.BUCKET)
+ chrome_util = chrome_utils.ChromeUtils(bucket)
+ # Fail if the test run is not associated with a set of Expectations.
+ if not chrome_util.CanRebaselineToTestRun(test_run):
+ self.response.header['Content-Type'] = 'json/application'
+ self.response.write(json.dumps(
+ {'error': 'Can not rebaseline to the given test run.'}))
+ return
+ # Update versions file.
+ chrome_util.RebaselineToTestRun(test_run)
+ # Redirect back to the sites list for the test run.
+ self.redirect('/?test_run=%s' % test_run)

Powered by Google App Engine
This is Rietveld 408576698