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

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

Issue 1867093003: MD Settings: Certificate manager, respect export/edit/delete restrictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 8 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/certificate_manager_page/certificates_browser_proxy.js ('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/certificate_manager_page_test.js
diff --git a/chrome/test/data/webui/settings/certificate_manager_page_test.js b/chrome/test/data/webui/settings/certificate_manager_page_test.js
index 139eaadf279dc269a06a12dd592a2ec29d170552..ab62b62e2dd086094e37e9825998b9b78753277c 100644
--- a/chrome/test/data/webui/settings/certificate_manager_page_test.js
+++ b/chrome/test/data/webui/settings/certificate_manager_page_test.js
@@ -530,12 +530,20 @@ cr.define('certificate_manager_page', function() {
// once tapped the correct event is fired.
test('MenuOptions_Edit', function() {
var editButton = subentry.shadowRoot.querySelector('#edit');
+ assertTrue(!!editButton);
// Should be disabled for any certificate type other than
// CertificateType.CA
assertTrue(editButton.hidden);
subentry.certificateType = settings.CertificateType.CA;
assertFalse(editButton.hidden);
+ // Should be disabled if |policy| is true.
+ var model = createSampleCertificateSubnode();
+ model.policy = true;
+ subentry.model = model;
+ assertTrue(editButton.hidden);
+
+ subentry.model = createSampleCertificateSubnode();
var waitForActionEvent = actionEventToPromise();
MockInteractions.tap(editButton);
return waitForActionEvent.then(function(event) {
@@ -550,14 +558,22 @@ cr.define('certificate_manager_page', function() {
// Test that the 'Delete' option is only shown when appropriate and that
// once tapped the correct event is fired.
test('MenuOptions_Delete', function() {
- subentry.set('model.readonly', true);
-
var deleteButton = subentry.shadowRoot.querySelector('#delete');
+ assertTrue(!!deleteButton);
+
// Should be disabled when 'model.readonly' is true.
+ var model = createSampleCertificateSubnode();
+ model.readonly = true;
+ subentry.model = model;
+ assertTrue(deleteButton.hidden);
+
+ // Should be disabled when 'model.policy' is true.
+ var model = createSampleCertificateSubnode();
+ model.policy = true;
+ subentry.model = model;
assertTrue(deleteButton.hidden);
- subentry.set('model.readonly', false);
- assertFalse(deleteButton.hidden);
+ subentry.model = createSampleCertificateSubnode();
var waitForActionEvent = actionEventToPromise();
MockInteractions.tap(deleteButton);
return waitForActionEvent.then(function(event) {
@@ -568,10 +584,13 @@ cr.define('certificate_manager_page', function() {
});
});
- // Test case of exporting a certificate that is not PERSONAL.
+ // Test that the 'Export' option is always shown when the certificate type
+ // is not PERSONAL and that once tapped the correct event is fired.
test('MenuOptions_Export', function() {
subentry.certificateType = settings.CertificateType.SERVER;
var exportButton = subentry.shadowRoot.querySelector('#export');
+ assertTrue(!!exportButton);
+ assertFalse(exportButton.hidden);
MockInteractions.tap(exportButton);
return browserProxy.whenCalled('exportCertificate').then(function(id) {
assertEquals(subentry.model.id, id);
@@ -580,9 +599,18 @@ cr.define('certificate_manager_page', function() {
// Test case of exporting a PERSONAL certificate.
test('MenuOptions_ExportPersonal', function() {
- var waitForActionEvent = actionEventToPromise();
-
var exportButton = subentry.shadowRoot.querySelector('#export');
+ assertTrue(!!exportButton);
+
+ // Should be disabled when 'model.extractable' is false.
+ assertTrue(exportButton.hidden);
+
+ var model = createSampleCertificateSubnode();
+ model.extractable = true;
+ subentry.model = model;
+ assertFalse(exportButton.hidden);
+
+ var waitForActionEvent = actionEventToPromise();
MockInteractions.tap(exportButton);
return browserProxy.whenCalled('exportPersonalCertificate').then(
function(id) {
« no previous file with comments | « chrome/browser/resources/settings/certificate_manager_page/certificates_browser_proxy.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698