OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 media-router-container. */ | 5 /** @fileoverview Suite of tests for media-router-container. */ |
6 cr.define('media_router_container', function() { | 6 cr.define('media_router_container', function() { |
7 function registerTests() { | 7 function registerTests() { |
8 suite('MediaRouterContainer', function() { | 8 suite('MediaRouterContainer', function() { |
9 /** | 9 /** |
10 * Media Router Container created before each test. | 10 * Media Router Container created before each test. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // Allow for the media router container to be created and attached. | 166 // Allow for the media router container to be created and attached. |
167 setTimeout(done); | 167 setTimeout(done); |
168 }); | 168 }); |
169 | 169 |
170 // Tests for 'acknowledge-first-run-flow' event firing when the | 170 // Tests for 'acknowledge-first-run-flow' event firing when the |
171 // 'first-run-button' button is clicked. | 171 // 'first-run-button' button is clicked. |
172 test('first run button click', function(done) { | 172 test('first run button click', function(done) { |
173 container.showFirstRunFlow = true; | 173 container.showFirstRunFlow = true; |
174 | 174 |
175 setTimeout(function() { | 175 setTimeout(function() { |
176 container.addEventListener('acknowledge-first-run-flow', function() { | 176 container.addEventListener('acknowledge-first-run-flow', |
| 177 function(data) { |
| 178 assertFalse(data.detail.optedIntoCloudServices); |
177 done(); | 179 done(); |
178 }); | 180 }); |
179 MockInteractions.tap(container.shadowRoot.getElementById( | 181 MockInteractions.tap(container.shadowRoot.getElementById( |
180 'first-run-button')); | 182 'first-run-button')); |
181 }); | 183 }); |
182 }); | 184 }); |
183 | 185 |
| 186 // Tests for 'acknowledge-first-run-flow' event firing when the |
| 187 // 'first-run-button' button is clicked and the cloud preference checkbox |
| 188 // is also shown. |
| 189 test('first run button with cloud pref click', function(done) { |
| 190 container.showFirstRunFlow = true; |
| 191 container.showFirstRunFlowCloudPref = true; |
| 192 |
| 193 setTimeout(function() { |
| 194 container.addEventListener('acknowledge-first-run-flow', |
| 195 function(data) { |
| 196 assertTrue(data.detail.optedIntoCloudServices); |
| 197 done(); |
| 198 }); |
| 199 MockInteractions.tap(container.shadowRoot.getElementById( |
| 200 'first-run-button')); |
| 201 }); |
| 202 }); |
| 203 |
| 204 // Tests for 'acknowledge-first-run-flow' event firing when the |
| 205 // 'first-run-button' button is clicked after the cloud preference |
| 206 // checkbox is deselected. |
| 207 test('first run button with cloud pref deselected click', |
| 208 function(done) { |
| 209 container.showFirstRunFlow = true; |
| 210 container.showFirstRunFlowCloudPref = true; |
| 211 |
| 212 setTimeout(function() { |
| 213 container.addEventListener('acknowledge-first-run-flow', |
| 214 function(data) { |
| 215 assertFalse(data.detail.optedIntoCloudServices); |
| 216 done(); |
| 217 }); |
| 218 MockInteractions.tap(container.shadowRoot.getElementById( |
| 219 'first-run-cloud-checkbox')); |
| 220 MockInteractions.tap(container.shadowRoot.getElementById( |
| 221 'first-run-button')); |
| 222 }); |
| 223 }); |
| 224 |
184 // Tests for 'create-route' event firing when a sink with no associated | 225 // Tests for 'create-route' event firing when a sink with no associated |
185 // route is clicked. | 226 // route is clicked. |
186 test('select sink without a route', function(done) { | 227 test('select sink without a route', function(done) { |
187 container.allSinks = fakeSinkList; | 228 container.allSinks = fakeSinkList; |
188 | 229 |
189 setTimeout(function() { | 230 setTimeout(function() { |
190 var sinkList = | 231 var sinkList = |
191 container.$['sink-list'].querySelectorAll('paper-item'); | 232 container.$['sink-list'].querySelectorAll('paper-item'); |
192 container.addEventListener('create-route', function(data) { | 233 container.addEventListener('create-route', function(data) { |
193 // Container is initially in auto mode since a cast mode has not | 234 // Container is initially in auto mode since a cast mode has not |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 }); | 894 }); |
854 }); | 895 }); |
855 }); | 896 }); |
856 }); | 897 }); |
857 } | 898 } |
858 | 899 |
859 return { | 900 return { |
860 registerTests: registerTests, | 901 registerTests: registerTests, |
861 }; | 902 }; |
862 }); | 903 }); |
OLD | NEW |