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

Unified Diff: components/test/data/autofill/automated_integration/autofill_task/generator.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_task/generator.py
diff --git a/components/test/data/autofill/automated_integration/autofill_task/generator.py b/components/test/data/autofill/automated_integration/autofill_task/generator.py
new file mode 100644
index 0000000000000000000000000000000000000000..73281f4778040897e167ebe2e07759c78671d75c
--- /dev/null
+++ b/components/test/data/autofill/automated_integration/autofill_task/generator.py
@@ -0,0 +1,40 @@
+# 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.
+
+from random import choice
+from string import ascii_lowercase
+
+
+class Generator(object):
+ """A string generator utility.
+ """
+ def __init__(self):
+ super(Generator, self).__init__()
+
+ @staticmethod
+ def _lower_case_string(length=8):
+ return ''.join(choice(ascii_lowercase) for i in range(length))
+
+ @staticmethod
+ def email():
+ """Generates a fake email address.
+
+ Format: 8 character string at an 8 character .com domain name
+
+ Returns: The generated email address string.
+ """
+ return '%s@%s.com' % (Generator._lower_case_string(),
+ Generator._lower_case_string())
+
+ @staticmethod
+ def password():
+ """Generates a fake password.
+
+ Format: 8 character lowercase string plus 'A!234&'
+ The postpended string exists to assist in satisfying common "secure
+ password" requirements
+
+ Returns: The generated password string.
+ """
+ return 'A!234&%s' % Generator._lower_case_string()

Powered by Google App Engine
This is Rietveld 408576698