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

Side by Side Diff: chrome/test/data/webui/settings/protocol_handlers_tests.js

Issue 2598893002: [MD settings] lighter weight initializer for protocol handler enabled messages (Closed)
Patch Set: review changes Created 3 years, 12 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 unified diff | Download patch
OLDNEW
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 /** @fileoverview Suite of tests for protocol_handlers. */ 5 /** @fileoverview Suite of tests for protocol_handlers. */
6 cr.define('protocol_handlers', function() { 6 cr.define('protocol_handlers', function() {
7 function registerTests() { 7 function registerTests() {
8 suite('ProtocolHandlers', function() { 8 suite('ProtocolHandlers', function() {
9 /** 9 /**
10 * A dummy protocol handler element created before each test. 10 * A dummy protocol handler element created before each test.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 testElement.remove(); 69 testElement.remove();
70 testElement = null; 70 testElement = null;
71 }); 71 });
72 72
73 /** @return {!Promise} */ 73 /** @return {!Promise} */
74 function initPage() { 74 function initPage() {
75 browserProxy.reset(); 75 browserProxy.reset();
76 PolymerTest.clearBody(); 76 PolymerTest.clearBody();
77 testElement = document.createElement('protocol-handlers'); 77 testElement = document.createElement('protocol-handlers');
78 document.body.appendChild(testElement); 78 document.body.appendChild(testElement);
79 return browserProxy.whenCalled('initializeProtocolHandlerList'). 79 return browserProxy.whenCalled('observeProtocolHandlers').
80 then(Polymer.dom.flush.bind(Polymer.dom)); 80 then(Polymer.dom.flush.bind(Polymer.dom));
81 } 81 }
82 82
83 test('empty list', function() { 83 test('empty list', function() {
84 return initPage().then(function(){ 84 return initPage().then(function(){
85 var listFrames = testElement.root.querySelectorAll('.list-frame'); 85 var listFrames = testElement.root.querySelectorAll('.list-frame');
86 assertEquals(0, listFrames.length); 86 assertEquals(0, listFrames.length);
87 }); 87 });
88 }); 88 });
89 89
(...skipping 17 matching lines...) Expand all
107 // Check that item default subtexts are rendered correctly. 107 // Check that item default subtexts are rendered correctly.
108 var defText = testElement.root.querySelectorAll('.protocol-default'); 108 var defText = testElement.root.querySelectorAll('.protocol-default');
109 assertFalse(defText[0].hidden); 109 assertFalse(defText[0].hidden);
110 assertFalse(defText[1].hidden); 110 assertFalse(defText[1].hidden);
111 assertTrue(defText[2].hidden); 111 assertTrue(defText[2].hidden);
112 }); 112 });
113 }); 113 });
114 114
115 /** 115 /**
116 * A reusable function to test different action buttons. 116 * A reusable function to test different action buttons.
117 * @param {!string} button id of the button to test. 117 * @param {string} button id of the button to test.
118 * @param {!string} handler name of browserProxy handler to react. 118 * @param {string} handler name of browserProxy handler to react.
119 * @return {!Promise} 119 * @return {!Promise}
120 */ 120 */
121 function testButtonFlow(button, browserProxyHandler) { 121 function testButtonFlow(button, browserProxyHandler) {
122 var menuButtons, functionButton, dialog; 122 var menuButtons, functionButton, dialog;
123 123
124 return initPage().then(function(){ 124 return initPage().then(function(){
125 // Initiating the elements 125 // Initiating the elements
126 menuButtons = testElement.root. 126 menuButtons = testElement.root.
127 querySelectorAll('paper-icon-button'); 127 querySelectorAll('paper-icon-button');
128 functionButton = testElement.$[button]; 128 functionButton = testElement.$[button];
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 browserProxy.setProtocolHandlers(protocols); 167 browserProxy.setProtocolHandlers(protocols);
168 return testButtonFlow('defaultButton', 'setProtocolDefault'); 168 return testButtonFlow('defaultButton', 'setProtocolDefault');
169 }); 169 });
170 }); 170 });
171 } 171 }
172 172
173 return { 173 return {
174 registerTests: registerTests, 174 registerTests: registerTests,
175 }; 175 };
176 }); 176 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698