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

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

Issue 2528523002: MD Settings: add unit tests for <extension-controlled-indicator> (Closed)
Patch Set: minus dep Created 4 years, 1 month 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/test/data/webui/settings/cr_settings_browsertest.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/extension_controlled_indicator_tests.js
diff --git a/chrome/test/data/webui/settings/extension_controlled_indicator_tests.js b/chrome/test/data/webui/settings/extension_controlled_indicator_tests.js
new file mode 100644
index 0000000000000000000000000000000000000000..bf5972b4576a3181c6f8f10e97748f2fde8dff0c
--- /dev/null
+++ b/chrome/test/data/webui/settings/extension_controlled_indicator_tests.js
@@ -0,0 +1,69 @@
+// 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.
+
+suite('extension controlled indicator', function() {
+ /** @type {TestExtensionControlBrowserProxy} */
+ var browserProxy;
+
+ /** @type {ExtensionControlledIndicatorElement} */
+ var indicator;
+
+ setup(function() {
+ PolymerTest.clearBody();
+ browserProxy = new TestExtensionControlBrowserProxy();
+ settings.ExtensionControlBrowserProxyImpl.instance_ = browserProxy;
+ indicator = document.createElement('extension-controlled-indicator');
+ indicator.extensionId = 'peiafolljookckjknpgofpbjobgbmpge';
+ indicator.extensionCanBeDisabled = true;
+ indicator.extensionName = 'The Bestest Name Ever';
+ document.body.appendChild(indicator);
+ Polymer.dom.flush();
+ });
+
+ test('disable button tracks extensionCanBeDisabled', function() {
+ assertTrue(indicator.extensionCanBeDisabled);
+ assertTrue(!!indicator.$$('paper-button'));
+
+ indicator.extensionCanBeDisabled = false;
+ Polymer.dom.flush();
+ assertFalse(!!indicator.$$('paper-button'));
+ });
+
+ test('label text and href', function() {
+ var imgSrc = indicator.$$('img').src;
+ assertTrue(imgSrc.includes(indicator.extensionId));
+
+ var label = indicator.$$('span');
+ assertTrue(!!label);
+ var labelLink = label.querySelector('a');
+ assertTrue(!!labelLink);
+ assertEquals(labelLink.textContent, indicator.extensionName);
+
+ assertEquals('chrome://extensions', new URL(labelLink.href).origin);
+ assertTrue(labelLink.href.includes(indicator.extensionId));
+
+ indicator.extensionId = 'dpjamkmjmigaoobjbekmfgabipmfilij';
+ indicator.extensionName = "A Slightly Less Good Name (Can't Beat That ^)";
+ Polymer.dom.flush();
+
+ imgSrc = indicator.$$('img').src;
+ assertTrue(imgSrc.includes(indicator.extensionId));
+
+ label = indicator.$$('span');
+ assertTrue(!!label);
+ labelLink = label.querySelector('a');
+ assertTrue(!!labelLink);
+ assertEquals(labelLink.textContent, indicator.extensionName);
+ });
+
+ test('tapping disable button invokes browser proxy', function() {
+ var disableButton = indicator.$$('paper-button');
+ assertTrue(!!disableButton);
+ MockInteractions.tap(disableButton);
+ return browserProxy.whenCalled('disableExtension').then(
+ function (extensionId) {
+ assertEquals(extensionId, indicator.extensionId);
+ });
+ });
+});
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698