| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @implements {settings.AndroidAppsBrowserProxy} | 7 * @implements {settings.AndroidAppsBrowserProxy} |
| 8 * @extends {settings.TestBrowserProxy} | 8 * @extends {settings.TestBrowserProxy} |
| 9 */ | 9 */ |
| 10 function TestAndroidAppsBrowserProxy() { | 10 function TestAndroidAppsBrowserProxy() { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 androidAppsPage.prefs = { | 54 androidAppsPage.prefs = { |
| 55 arc: { | 55 arc: { |
| 56 enabled: { | 56 enabled: { |
| 57 value: false, | 57 value: false, |
| 58 }, | 58 }, |
| 59 }, | 59 }, |
| 60 }; | 60 }; |
| 61 cr.webUIListenerCallback( | 61 cr.webUIListenerCallback( |
| 62 'android-apps-info-update', {appReady: false}); | 62 'android-apps-info-update', {appReady: false}); |
| 63 Polymer.dom.flush(); | 63 Polymer.dom.flush(); |
| 64 var checkbox = androidAppsPage.$$('#enabledCheckbox'); | 64 var control = androidAppsPage.$$('#enabled'); |
| 65 assertTrue(!!checkbox); | 65 assertTrue(!!control); |
| 66 assertFalse(checkbox.disabled); | 66 assertFalse(control.disabled); |
| 67 assertFalse(checkbox.checked); | 67 assertFalse(control.checked); |
| 68 var managed = androidAppsPage.$$('#manageApps'); | 68 var managed = androidAppsPage.$$('#manageApps'); |
| 69 assertTrue(!!managed); | 69 assertTrue(!!managed); |
| 70 assertTrue(managed.hidden); | 70 assertTrue(managed.hidden); |
| 71 | 71 |
| 72 MockInteractions.tap(checkbox.$.checkbox); | 72 MockInteractions.tap(control.$.control); |
| 73 Polymer.dom.flush(); | 73 Polymer.dom.flush(); |
| 74 assertTrue(checkbox.checked); | 74 assertTrue(control.checked); |
| 75 }); | 75 }); |
| 76 }); | 76 }); |
| 77 | 77 |
| 78 test('Disable', function() { | 78 test('Disable', function() { |
| 79 return androidAppsBrowserProxy.whenCalled('requestAndroidAppsInfo') | 79 return androidAppsBrowserProxy.whenCalled('requestAndroidAppsInfo') |
| 80 .then(function() { | 80 .then(function() { |
| 81 androidAppsPage.prefs = { | 81 androidAppsPage.prefs = { |
| 82 arc: { | 82 arc: { |
| 83 enabled: { | 83 enabled: { |
| 84 value: true, | 84 value: true, |
| 85 }, | 85 }, |
| 86 }, | 86 }, |
| 87 }; | 87 }; |
| 88 cr.webUIListenerCallback( | 88 cr.webUIListenerCallback( |
| 89 'android-apps-info-update', {appReady: true}); | 89 'android-apps-info-update', {appReady: true}); |
| 90 Polymer.dom.flush(); | 90 Polymer.dom.flush(); |
| 91 var checkbox = androidAppsPage.$$('#enabledCheckbox'); | 91 var control = androidAppsPage.$$('#enabled'); |
| 92 assertTrue(!!checkbox); | 92 assertTrue(!!control); |
| 93 assertFalse(checkbox.disabled); | 93 assertFalse(control.disabled); |
| 94 assertTrue(checkbox.checked); | 94 assertTrue(control.checked); |
| 95 var managed = androidAppsPage.$$('#manageApps'); | 95 var managed = androidAppsPage.$$('#manageApps'); |
| 96 assertTrue(!!managed); | 96 assertTrue(!!managed); |
| 97 assertFalse(managed.hidden); | 97 assertFalse(managed.hidden); |
| 98 | 98 |
| 99 MockInteractions.tap(checkbox.$.checkbox); | 99 MockInteractions.tap(control.$.control); |
| 100 cr.webUIListenerCallback( | 100 cr.webUIListenerCallback( |
| 101 'android-apps-info-update', {appReady: false}); | 101 'android-apps-info-update', {appReady: false}); |
| 102 Polymer.dom.flush(); | 102 Polymer.dom.flush(); |
| 103 var dialog = androidAppsPage.$$('#confirmDisableDialog'); | 103 var dialog = androidAppsPage.$$('#confirmDisableDialog'); |
| 104 assertTrue(!!dialog); | 104 assertTrue(!!dialog); |
| 105 assertTrue(dialog.open); | 105 assertTrue(dialog.open); |
| 106 var actionButton = | 106 var actionButton = |
| 107 androidAppsPage.$$('dialog paper-button.action-button'); | 107 androidAppsPage.$$('dialog paper-button.action-button'); |
| 108 assertTrue(!!actionButton); | 108 assertTrue(!!actionButton); |
| 109 MockInteractions.tap(actionButton); | 109 MockInteractions.tap(actionButton); |
| 110 Polymer.dom.flush(); | 110 Polymer.dom.flush(); |
| 111 assertFalse(checkbox.checked); | 111 assertFalse(control.checked); |
| 112 assertTrue(managed.hidden); | 112 assertTrue(managed.hidden); |
| 113 }); | 113 }); |
| 114 }); | 114 }); |
| 115 }); | 115 }); |
| OLD | NEW |