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

Unified Diff: components/test/data/autofill/automated_integration/autofill_test/case.py

Issue 2116583004: Automated Autofill testing library + extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits, reduced preferences Created 4 years, 5 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: components/test/data/autofill/automated_integration/autofill_test/case.py
diff --git a/components/test/data/autofill/automated_integration/autofill_test/case.py b/components/test/data/autofill/automated_integration/autofill_test/case.py
new file mode 100644
index 0000000000000000000000000000000000000000..7c77b00e944617f3a76fade3ba2f64334cd4a395
--- /dev/null
+++ b/components/test/data/autofill/automated_integration/autofill_test/case.py
@@ -0,0 +1,47 @@
+# Copyright 2016 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.
+
+import sys
+import unittest
+
+from selenium.common.exceptions import TimeoutException
+
+# Local Imports
+from autofill_task.exceptions import ExpectationFailure
+from .flow import AutofillTestFlow
+
+class AutofillTestCase(unittest.TestCase):
+ """Wraps a single autofill test flow for use with the unittest library.
+
+ task_class: AutofillTask to use for the test.
+ profile: Dict of profile data that acts as the master source for
+ validating autofill behaviour.
+ debug: Whether debug output should be printed (False if not specified).
+ """
+ def __init__(self, task_class, user_data_dir, profile, chrome_binary=None,
+ debug=False):
+ super(AutofillTestCase, self).__init__('run')
+ self._flow = AutofillTestFlow(task_class, profile, debug=debug)
+ self._user_data_dir = user_data_dir
+ self._chrome_binary = chrome_binary
+ self._debug = debug
+
+ def __str__(self):
+ return str(self._flow)
+
+ def run(self, result):
+ result.startTest(self)
+
+ try:
+ self._flow.run(self._user_data_dir, chrome_binary=self._chrome_binary)
+ except KeyboardInterrupt:
+ raise
+ except (TimeoutException, ExpectationFailure):
+ result.addFailure(self, sys.exc_info())
+ except:
+ result.addError(self, sys.exc_info())
+ else:
+ result.addSuccess(self)
+ finally:
+ result.stopTest(self)

Powered by Google App Engine
This is Rietveld 408576698