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

Side by Side 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 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 suite('extension controlled indicator', function() {
6 /** @type {TestExtensionControlBrowserProxy} */
7 var browserProxy;
8
9 /** @type {ExtensionControlledIndicatorElement} */
10 var indicator;
11
12 setup(function() {
13 PolymerTest.clearBody();
14 browserProxy = new TestExtensionControlBrowserProxy();
15 settings.ExtensionControlBrowserProxyImpl.instance_ = browserProxy;
16 indicator = document.createElement('extension-controlled-indicator');
17 indicator.extensionId = 'peiafolljookckjknpgofpbjobgbmpge';
18 indicator.extensionCanBeDisabled = true;
19 indicator.extensionName = 'The Bestest Name Ever';
20 document.body.appendChild(indicator);
21 Polymer.dom.flush();
22 });
23
24 test('disable button tracks extensionCanBeDisabled', function() {
25 assertTrue(indicator.extensionCanBeDisabled);
26 assertTrue(!!indicator.$$('paper-button'));
27
28 indicator.extensionCanBeDisabled = false;
29 Polymer.dom.flush();
30 assertFalse(!!indicator.$$('paper-button'));
31 });
32
33 test('label text and href', function() {
34 var imgSrc = indicator.$$('img').src;
35 assertTrue(imgSrc.includes(indicator.extensionId));
36
37 var label = indicator.$$('span');
38 assertTrue(!!label);
39 var labelLink = label.querySelector('a');
40 assertTrue(!!labelLink);
41 assertEquals(labelLink.textContent, indicator.extensionName);
42
43 assertEquals('chrome://extensions', new URL(labelLink.href).origin);
44 assertTrue(labelLink.href.includes(indicator.extensionId));
45
46 indicator.extensionId = 'dpjamkmjmigaoobjbekmfgabipmfilij';
47 indicator.extensionName = "A Slightly Less Good Name (Can't Beat That ^)";
48 Polymer.dom.flush();
49
50 imgSrc = indicator.$$('img').src;
51 assertTrue(imgSrc.includes(indicator.extensionId));
52
53 label = indicator.$$('span');
54 assertTrue(!!label);
55 labelLink = label.querySelector('a');
56 assertTrue(!!labelLink);
57 assertEquals(labelLink.textContent, indicator.extensionName);
58 });
59
60 test('tapping disable button invokes browser proxy', function() {
61 var disableButton = indicator.$$('paper-button');
62 assertTrue(!!disableButton);
63 MockInteractions.tap(disableButton);
64 return browserProxy.whenCalled('disableExtension').then(
65 function (extensionId) {
66 assertEquals(extensionId, indicator.extensionId);
67 });
68 });
69 });
OLDNEW
« 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