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

Unified Diff: components/test/data/password_manager/automated_tests/tests.py

Issue 1089383002: [Password manager tests automation] Refactor test_runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base
Patch Set: Created 5 years, 8 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
« no previous file with comments | « components/test/data/password_manager/automated_tests/run_tests.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test/data/password_manager/automated_tests/tests.py
diff --git a/components/test/data/password_manager/automated_tests/tests.py b/components/test/data/password_manager/automated_tests/tests.py
index bddbafb101ba8a3202d73f28d54b6ff111e4df26..f8fe6ff853d1f3398f5a2eb3cd16905fc5170659 100644
--- a/components/test/data/password_manager/automated_tests/tests.py
+++ b/components/test/data/password_manager/automated_tests/tests.py
@@ -11,6 +11,9 @@ from environment import Environment
from websitetest import WebsiteTest
+TEST_CASES = ("PromptFailTest", "PromptSuccessTest", "SaveAndAutofillTest")
+
+
class Alexa(WebsiteTest):
def Login(self):
@@ -504,8 +507,10 @@ def SaveResults(environment_tests_results, environment_save_path,
with open(environment_save_path, "w") as save_file:
save_file.write(xml)
+
def RunTest(chrome_path, chromedriver_path, profile_path,
- environment_passwords_path, website_test_name, test_case_name):
+ environment_passwords_path, website_test_name,
+ test_case_name):
"""Runs the test for the specified website.
Args:
@@ -528,15 +533,16 @@ def RunTest(chrome_path, chromedriver_path, profile_path,
environment = Environment(chrome_path, chromedriver_path, profile_path,
environment_passwords_path,
enable_automatic_password_saving)
+ try:
+ if website_test_name in all_tests:
+ environment.AddWebsiteTest(all_tests[website_test_name])
+ else:
+ raise Exception("Test name {} is unknown.".format(website_test_name))
- if website_test_name in all_tests:
- environment.AddWebsiteTest(all_tests[website_test_name])
- else:
- raise Exception("Test name {} is unknown.".format(website_test_name))
-
- environment.RunTestsOnSites(test_case_name)
- environment.Quit()
- return environment.tests_results
+ environment.RunTestsOnSites(test_case_name)
+ return environment.tests_results
+ finally:
+ environment.Quit()
def main():
parser = argparse.ArgumentParser(
@@ -575,9 +581,7 @@ def main():
if args.save_path:
save_path = args.save_path
- test_cases_to_run = args.test_cases_to_run or\
- ("PromptFailTest", "PromptSuccessTest", "SaveAndAutofillTest")
-
+ test_cases_to_run = args.test_cases_to_run or TEST_CASES
for test_case in test_cases_to_run:
tests_results = RunTest(
args.chrome_path, args.chromedriver_path, args.profile_path,
« no previous file with comments | « components/test/data/password_manager/automated_tests/run_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698