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

Unified Diff: chrome/browser/resources/settings/people_page/quick_unlock_choose_method.js

Issue 2157673002: Browser tests for the quick_unlock settings pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pin-unlock-quick-unlock-interface
Patch Set: 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: chrome/browser/resources/settings/people_page/quick_unlock_choose_method.js
diff --git a/chrome/browser/resources/settings/people_page/quick_unlock_choose_method.js b/chrome/browser/resources/settings/people_page/quick_unlock_choose_method.js
index db0a57993622827f94dbf33c74d096ee2db6ca6b..bb6cf54d6a0f564192910422af16fec294bb8592 100644
--- a/chrome/browser/resources/settings/people_page/quick_unlock_choose_method.js
+++ b/chrome/browser/resources/settings/people_page/quick_unlock_choose_method.js
@@ -54,7 +54,27 @@ Polymer({
notify: true,
value: QuickUnlockUnlockType.VALUE_PENDING,
observer: 'selectedUnlockTypeChanged_'
- }
+ },
+
+ /**
+ * Interface for chrome.quickUnlockPrivate calls. May be overriden by tests.
+ * @private
+ * @type {QuickUnlockPrivate}
+ */
+ quickUnlockPrivate_: {
+ type: Object,
+ value: chrome.quickUnlockPrivate
+ },
+
+ /**
+ * Interface for chrome.settingsPrivate calls. May be overriden by tests.
+ * @private
+ * @type {SettingsPrivate}
+ */
+ settingsPrivate_: {
+ type: Object,
+ value: chrome.settingsPrivate
+ },
},
observers: [
@@ -74,9 +94,9 @@ Polymer({
}.bind(this);
this.boundOnActiveModesChanged_ = this.updateUnlockType_.bind(this);
- chrome.settingsPrivate.onPrefsChanged.addListener(
+ this.settingsPrivate_.onPrefsChanged.addListener(
this.boundOnPrefsChanged_);
- chrome.quickUnlockPrivate.onActiveModesChanged.addListener(
+ this.quickUnlockPrivate_.onActiveModesChanged.addListener(
this.boundOnActiveModesChanged_);
this.askForPasswordIfUnset();
@@ -84,9 +104,9 @@ Polymer({
/** @override */
detached: function() {
- chrome.settingsPrivate.onPrefsChanged.removeListener(
+ this.settingsPrivate_.onPrefsChanged.removeListener(
this.boundOnPrefsChanged_);
- chrome.quickUnlockPrivate.onActiveModesChanged.removeListener(
+ this.quickUnlockPrivate_.onActiveModesChanged.removeListener(
this.boundOnActiveModesChanged_);
},
@@ -121,7 +141,7 @@ Polymer({
return;
}
- chrome.quickUnlockPrivate.getActiveModes(function(modes) {
+ this.quickUnlockPrivate_.getActiveModes(function(modes) {
if (modes.includes(chrome.quickUnlockPrivate.QuickUnlockMode.PIN)) {
this.selectedUnlockType_ = QuickUnlockUnlockType.PIN_PASSWORD;
} else if (this.selectedUnlockType_ !=
@@ -148,7 +168,7 @@ Polymer({
selectedUnlockTypeChanged_: function(selected, previous) {
// This method gets invoked when setting the initial value from the existing
// state. In that case, we don't need to bother updating the prefs.
- if (!previous)
+ if (!previous || previous == QuickUnlockUnlockType.VALUE_PENDING)
return;
this.setPrefValue(ENABLE_LOCK_SCREEN_PREF,

Powered by Google App Engine
This is Rietveld 408576698