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

Side by Side Diff: components/test/data/password_manager/run_tests.py

Issue 403323002: Automatic password manager tests now rely on being killed by the bot on timeout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/test/data/password_manager/websitetest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """This file allows the bots to be easily configure and run the tests.""" 6 """This file allows the bots to be easily configure and run the tests."""
7 7
8 import argparse 8 import argparse
9 import os 9 import os
10 import tempfile 10 import tempfile
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 results_path = results.name 46 results_path = results.name
47 results.close() 47 results.close()
48 48
49 full_path = os.path.realpath(__file__) 49 full_path = os.path.realpath(__file__)
50 tests_dir = os.path.dirname(full_path) 50 tests_dir = os.path.dirname(full_path)
51 tests_path = os.path.join(tests_dir, "tests.py") 51 tests_path = os.path.join(tests_dir, "tests.py")
52 52
53 for websitetest in environment.websitetests: 53 for websitetest in environment.websitetests:
54 # The tests can be flaky. This is why we try to rerun up to 3 times. 54 # The tests can be flaky. This is why we try to rerun up to 3 times.
55 for x in range(0, 3): 55 for x in range(0, 3):
56 # TODO(rchtara): Using "pkill" is just temporary until a better,
57 # platform-independent solution is found.
58 os.system("pkill chrome")
59 try: 56 try:
60 os.remove(results_path) 57 os.remove(results_path)
61 except Exception: 58 except Exception:
62 pass 59 pass
63 # TODO(rchtara): Using "timeout is just temporary until a better,
64 # platform-independent solution is found.
65 60
66 # The website test runs in two passes, each pass has an internal 61 print "Running tests for %s " % websitetest.name
67 # timeout of 200s for waiting (see |remaining_time_to_wait| and 62
68 # Wait() in websitetest.py). Accounting for some more time spent on 63 # Run the test without enable-automatic-password-saving to check whether
69 # the non-waiting execution, 300 seconds should be the upper bound on 64 # or not the prompt is shown in the way we expected.
70 # the runtime of one pass, thus 600 seconds for the whole test. 65 tests_results = tests.RunTests(args.chrome_path[0],
71 os.system("timeout 600 python %s %s --chrome-path %s " 66 args.chromedriver_path[0],
72 "--chromedriver-path %s --passwords-path %s --profile-path %s " 67 args.profile_path[0],
73 "--save-path %s" % 68 args.passwords_path[0],
74 (tests_path, websitetest.name, args.chrome_path[0], 69 False,
75 args.chromedriver_path[0], args.passwords_path[0], 70 10, # Debug log level.
76 args.profile_path[0], results_path)) 71 True,
72 None,
73 tests.TypeOfTestedWebsites.LIST_OF_TESTS,
74 [websitetest.name])
75
76 # Run the test with enable-automatic-password-saving to check whether
77 # or not the password is stored in the the way we expected.
78 tests_results += tests.RunTests(args.chrome_path[0],
79 args.chromedriver_path[0],
80 args.profile_path[0],
81 args.passwords_path[0],
82 True,
83 10, # Debug log level.
84 True,
85 None,
86 tests.TypeOfTestedWebsites.LIST_OF_TESTS,
87 [websitetest.name])
88
89 tests.saveResults(tests_results, results_path)
vabr (Chromium) 2014/07/21 08:39:52 Why would you save the tests to a file, and immedi
rchtara 2014/07/21 15:12:40 I wait for the answer of Aaron answer to know if i
77 if os.path.isfile(results_path): 90 if os.path.isfile(results_path):
78 results = open(results_path, "r") 91 results = open(results_path, "r")
79 count = 0 # Count the number of successful tests. 92 count = 0 # Count the number of successful tests.
80 for line in results: 93 for line in results:
81 xml.write(line) 94 xml.write(line)
82 count += line.count("successful='True'") 95 count += line.count("successful='True'")
83 results.close() 96 results.close()
84 # There is only two tests running for every website: the prompt and 97 # There is only two tests running for every website: the prompt and
85 # the normal test. If both of the tests were successful, the tests 98 # the normal test. If both of the tests were successful, the tests
86 # would be stopped for the current website. 99 # would be stopped for the current website.
87 if count == 2: 100 if count == 2:
88 break 101 break
89 else: 102 else:
90 xml.write("<result><test name='%s' type='prompt' successful='false'>" 103 xml.write("<result><test name='%s' type='prompt' successful='false'>"
91 "</test><test name='%s' type='normal' successful='false'></test>" 104 "</test><test name='%s' type='normal' successful='false'></test>"
92 "</result>" % (websitetest.name, websitetest.name)) 105 "</result>" % (websitetest.name, websitetest.name))
93 finally: 106 finally:
94 try: 107 try:
95 os.remove(results_path) 108 os.remove(results_path)
96 except Exception: 109 except Exception:
97 pass 110 pass
98 111
99 xml.write("</xml>") 112 xml.write("</xml>")
100 xml.close() 113 xml.close()
OLDNEW
« no previous file with comments | « no previous file | components/test/data/password_manager/websitetest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698