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

Unified Diff: chrome/test/data/webui/settings/passwords_and_forms_browsertest.js

Issue 2111643005: [MD Settings] Make Passwords and Autofill actionable if tap will work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/passwords_and_forms_browsertest.js
diff --git a/chrome/test/data/webui/settings/passwords_and_forms_browsertest.js b/chrome/test/data/webui/settings/passwords_and_forms_browsertest.js
index b983bc103f6ffa95d17fb4daf0dc479a84f87e73..56600d11343a76ed256338fd9a4bf4f415ac4636 100644
--- a/chrome/test/data/webui/settings/passwords_and_forms_browsertest.js
+++ b/chrome/test/data/webui/settings/passwords_and_forms_browsertest.js
@@ -223,7 +223,10 @@ PasswordsAndFormsBrowserTest.prototype = {
'passwords_and_forms_page.html',
/** @override */
- extraLibraries: PolymerTest.getLibraries(ROOT_PATH),
+ extraLibraries: PolymerTest.getLibraries(ROOT_PATH).concat([
+ '../fake_chrome_event.js',
+ 'fake_settings_private.js',
+ ]),
/** @override */
setUp: function() {
@@ -241,6 +244,11 @@ PasswordsAndFormsBrowserTest.prototype = {
AutofillManagerImpl.instance_ = this.autofillManager;
},
+ /** @override */
+ tearDown: function() {
+ PolymerTest.clearBody();
+ },
+
/**
* Creates a new passwords and forms element.
* @return {!Object}
@@ -253,6 +261,45 @@ PasswordsAndFormsBrowserTest.prototype = {
},
/**
+ * @pram {boolean} autofill Whether autofill is enabled or not.
+ * @param {boolean} passwords Whether passwords are enabled or not.
+ * @return {!Promise<!Element>} The |prefs| object.
+ */
+ createPrefs: function(autofill, passwords) {
+ return new Promise(function(resolve) {
+ CrSettingsPrefs.deferInitialization = true;
+ var prefs = document.createElement('settings-prefs');
+ document.body.appendChild(prefs);
+ prefs.initializeForTesting(new settings.FakeSettingsPrivate([
+ {
+ key: 'autofill.enabled',
+ type: chrome.settingsPrivate.PrefType.BOOLEAN,
+ value: autofill,
+ },
+ {
+ key: 'profile.password_manager_enabled',
+ type: chrome.settingsPrivate.PrefType.BOOLEAN,
+ value: passwords,
+ },
+ ]));
+
+ CrSettingsPrefs.initialized.then(function() {
+ resolve(prefs);
+ });
+ });
+ },
+
+ /**
+ * Cleans up prefs so tests can continue to run.
+ * @param {!Element} prefs The prefs element.
+ */
+ destroyPrefs: function(prefs) {
+ CrSettingsPrefs.resetForTesting();
+ CrSettingsPrefs.deferInitialization = false;
+ prefs.resetForTesting();
+ },
+
+ /**
* Creates PasswordManagerExpectations with the values expected after first
* creating the element.
* @return {!PasswordManagerExpectations}
@@ -372,6 +419,32 @@ TEST_F('PasswordsAndFormsBrowserTest', 'uiTests', function() {
self.passwordManager.assertExpectations(self.basePasswordExpectations());
self.autofillManager.assertExpectations(self.baseAutofillExpectations());
});
+
+ test('testActionabilityNope', function() {
+ return self.createPrefs(false, false).then(function(prefs) {
+ var element = self.createPasswordsAndFormsElement();
+ element.prefs = prefs.prefs;
+ Polymer.dom.flush();
+
+ assertFalse(element.$.autofillManagerButton.hasAttribute('actionable'));
+ assertFalse(element.$.passwordManagerButton.hasAttribute('actionable'));
+
+ self.destroyPrefs(prefs);
+ });
+ });
+
+ test('testActionabilityYes', function() {
+ return self.createPrefs(true, true).then(function(prefs) {
+ var element = self.createPasswordsAndFormsElement();
+ element.prefs = prefs.prefs;
+ Polymer.dom.flush();
+
+ assertTrue(element.$.autofillManagerButton.hasAttribute('actionable'));
+ assertTrue(element.$.passwordManagerButton.hasAttribute('actionable'));
+
+ self.destroyPrefs(prefs);
+ });
+ });
});
mocha.run();
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/passwords_and_forms_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698