| Index: chrome/browser/android/offline_pages/evaluation/run_offline_page_evaluation_test.py
|
| diff --git a/chrome/browser/android/offline_pages/evaluation/run_offline_page_evaluation_test.py b/chrome/browser/android/offline_pages/evaluation/run_offline_page_evaluation_test.py
|
| index d72635165b0d969dc47bed7cc91100f60cca7333..84d9bb7972562b5aae81832cb0ee19f3ee84c899 100755
|
| --- a/chrome/browser/android/offline_pages/evaluation/run_offline_page_evaluation_test.py
|
| +++ b/chrome/browser/android/offline_pages/evaluation/run_offline_page_evaluation_test.py
|
| @@ -21,9 +21,11 @@
|
|
|
| import argparse
|
| import os
|
| +import re
|
| import shutil
|
| import subprocess
|
| import sys
|
| +import urlparse
|
|
|
| DEFAULT_USER_REQUEST = True
|
| DEFAULT_USE_TEST_SCHEDULER = True
|
| @@ -155,9 +157,13 @@ def main(args):
|
| # Also turning off the strict mode so that we won't run into StrictMode
|
| # violations when writing to files.
|
| test_runner_cmd = [
|
| - test_runner_path, '-f',
|
| + test_runner_path,
|
| + '-f',
|
| 'OfflinePageSavePageLaterEvaluationTest.testFailureRate',
|
| - '--timeout-scale', '20.0', '--strict-mode', 'off',
|
| + '--timeout-scale',
|
| + '20.0',
|
| + '--strict-mode',
|
| + 'off',
|
| ]
|
| if options.verbose:
|
| test_runner_cmd += ['-v']
|
| @@ -184,6 +190,28 @@ def main(args):
|
| ]))
|
| print 'Test finished!'
|
|
|
| + print 'Renaming archive files with host names.'
|
| + pattern = 'Content-Location: (.*)'
|
| + for filename in os.listdir(archive_dir):
|
| + path = os.path.join(archive_dir, filename)
|
| + with open(path) as f:
|
| + content = f.read()
|
| + result = re.search(pattern, content)
|
| + if (result == None):
|
| + continue
|
| + url = result.group(1)
|
| + url_parse = urlparse.urlparse(url)
|
| + hostname = url_parse[1].replace('.', '_')
|
| + url_path = re.sub('[^0-9a-zA-Z]+', '_', url_parse[2][1:])
|
| +
|
| + if (len(hostname) == 0):
|
| + hostname = 'error_parsing_hostname'
|
| + continue
|
| + newname = hostname + '-' + url_path
|
| + newpath = os.path.join(archive_dir, newname + '.mhtml')
|
| + os.rename(path, newpath)
|
| + print 'Renaming finished.'
|
| +
|
|
|
| if __name__ == '__main__':
|
| sys.exit(main(sys.argv[1:]))
|
|
|