OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 (function() { | 7 (function() { |
8 | 8 |
9 /** | 9 /** |
10 * Obtains track text. | 10 * Obtains track text. |
11 * @param {string} audioAppId Window ID. | 11 * @param {string} audioAppId Window ID. |
12 * @param {query} query Query for the track. | 12 * @param {query} query Query for the track. |
13 * @return {Promise} Promise to be fulfilled with {title:string, artist:string} | 13 * @return {Promise} Promise to be fulfilled with {title:string, artist:string} |
14 * object. | 14 * object. |
15 */ | 15 */ |
16 function getTrackText(audioAppId, query) { | 16 function getTrackText(audioAppId, query) { |
17 var titleElements = callRemoteTestUtil( | 17 var titleElements = audioPlayerApp.callRemoteTestUtil( |
18 'queryAllElements', | 18 'queryAllElements', |
19 audioAppId, | 19 audioAppId, |
20 [query + ' > .data > .data-title']); | 20 [query + ' > .data > .data-title']); |
21 var artistElements = callRemoteTestUtil( | 21 var artistElements = audioPlayerApp.callRemoteTestUtil( |
22 'queryAllElements', | 22 'queryAllElements', |
23 audioAppId, | 23 audioAppId, |
24 [query + ' > .data > .data-artist']); | 24 [query + ' > .data > .data-artist']); |
25 return Promise.all([titleElements, artistElements]).then(function(data) { | 25 return Promise.all([titleElements, artistElements]).then(function(data) { |
26 return { | 26 return { |
27 title: data[0][0] && data[0][0].text, | 27 title: data[0][0] && data[0][0].text, |
28 artist: data[1][0] && data[1][0].text | 28 artist: data[1][0] && data[1][0].text |
29 }; | 29 }; |
30 }); | 30 }); |
31 } | 31 } |
(...skipping 30 matching lines...) Expand all Loading... |
62 waitForFileListChange(appId, expectedFilesBefore.length).then(this.next); | 62 waitForFileListChange(appId, expectedFilesBefore.length).then(this.next); |
63 }, | 63 }, |
64 function(actualFilesAfter) { | 64 function(actualFilesAfter) { |
65 chrome.test.assertEq(expectedFilesAfter, actualFilesAfter); | 65 chrome.test.assertEq(expectedFilesAfter, actualFilesAfter); |
66 callRemoteTestUtil( | 66 callRemoteTestUtil( |
67 'openFile', appId, ['Beautiful Song.ogg'], this.next); | 67 'openFile', appId, ['Beautiful Song.ogg'], this.next); |
68 }, | 68 }, |
69 // Wait for the audio player window. | 69 // Wait for the audio player window. |
70 function(result) { | 70 function(result) { |
71 chrome.test.assertTrue(result); | 71 chrome.test.assertTrue(result); |
72 waitForWindow('audio_player.html').then(this.next); | 72 audioPlayerApp.waitForWindow('audio_player.html').then(this.next); |
73 }, | 73 }, |
74 // Wait for the changes of the player status. | 74 // Wait for the changes of the player status. |
75 function(inAppId) { | 75 function(inAppId) { |
76 audioAppId = inAppId; | 76 audioAppId = inAppId; |
77 waitForElement(audioAppId, 'audio-player[playing]').then(this.next); | 77 audioPlayerApp.waitForElement( |
| 78 audioAppId, 'audio-player[playing]').then(this.next); |
78 }, | 79 }, |
79 // Get the source file name. | 80 // Get the source file name. |
80 function(element) { | 81 function(element) { |
81 chrome.test.assertEq( | 82 chrome.test.assertEq( |
82 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 83 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
83 'external' + path + '/Beautiful%20Song.ogg', | 84 'external' + path + '/Beautiful%20Song.ogg', |
84 element.attributes.currenttrackurl); | 85 element.attributes.currenttrackurl); |
85 var query1 = 'audio-player /deep/ .track[index="0"][active]'; | 86 var query1 = 'audio-player /deep/ .track[index="0"][active]'; |
86 var query2 = 'audio-player /deep/ .track[index="1"]:not([active])'; | 87 var query2 = 'audio-player /deep/ .track[index="1"]:not([active])'; |
87 repeatUntil(function() { | 88 repeatUntil(function() { |
88 var trackText1 = getTrackText(audioAppId, query1); | 89 var trackText1 = getTrackText(audioAppId, query1); |
89 var trackText2 = getTrackText(audioAppId, query2); | 90 var trackText2 = getTrackText(audioAppId, query2); |
90 return Promise.all([trackText1, trackText2]).then(function(tracks) { | 91 return Promise.all([trackText1, trackText2]).then(function(tracks) { |
91 var expected = [ | 92 var expected = [ |
92 {title: 'Beautiful Song', artist: 'Unknown Artist'}, | 93 {title: 'Beautiful Song', artist: 'Unknown Artist'}, |
(...skipping 10 matching lines...) Expand all Loading... |
103 function() { | 104 function() { |
104 callRemoteTestUtil( | 105 callRemoteTestUtil( |
105 'openFile', appId, ['newly added file.ogg'], this.next); | 106 'openFile', appId, ['newly added file.ogg'], this.next); |
106 }, | 107 }, |
107 // Wait for the changes of the player status. | 108 // Wait for the changes of the player status. |
108 function(result) { | 109 function(result) { |
109 chrome.test.assertTrue(result, 'Fail to open the 2nd file'); | 110 chrome.test.assertTrue(result, 'Fail to open the 2nd file'); |
110 var query = 'audio-player' + | 111 var query = 'audio-player' + |
111 '[playing]' + | 112 '[playing]' + |
112 '[currenttrackurl$="newly%20added%20file.ogg"]'; | 113 '[currenttrackurl$="newly%20added%20file.ogg"]'; |
113 waitForElement(audioAppId, query).then(this.next); | 114 audioPlayerApp.waitForElement(audioAppId, query).then(this.next); |
114 }, | 115 }, |
115 // Get the source file name. | 116 // Get the source file name. |
116 function(element) { | 117 function(element) { |
117 chrome.test.assertEq( | 118 chrome.test.assertEq( |
118 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 119 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
119 'external' + path + '/newly%20added%20file.ogg', | 120 'external' + path + '/newly%20added%20file.ogg', |
120 element.attributes.currenttrackurl); | 121 element.attributes.currenttrackurl); |
121 var query1 = 'audio-player /deep/ .track[index="0"]:not([active])'; | 122 var query1 = 'audio-player /deep/ .track[index="0"]:not([active])'; |
122 var query2 = 'audio-player /deep/ .track[index="1"][active]'; | 123 var query2 = 'audio-player /deep/ .track[index="1"][active]'; |
123 repeatUntil(function() { | 124 repeatUntil(function() { |
124 var trackText1 = getTrackText(audioAppId, query1); | 125 var trackText1 = getTrackText(audioAppId, query1); |
125 var trackText2 = getTrackText(audioAppId, query2); | 126 var trackText2 = getTrackText(audioAppId, query2); |
126 return Promise.all([trackText1, trackText2]).then(function(tracks) { | 127 return Promise.all([trackText1, trackText2]).then(function(tracks) { |
127 var expected = [ | 128 var expected = [ |
128 {title: 'Beautiful Song', artist: 'Unknown Artist'}, | 129 {title: 'Beautiful Song', artist: 'Unknown Artist'}, |
129 {title: 'newly added file', artist: 'Unknown Artist'} | 130 {title: 'newly added file', artist: 'Unknown Artist'} |
130 ]; | 131 ]; |
131 if (!chrome.test.checkDeepEq(expected, tracks)) { | 132 if (!chrome.test.checkDeepEq(expected, tracks)) { |
132 return pending('Tracks are expected as: %j, but is %j.', | 133 return pending('Tracks are expected as: %j, but is %j.', |
133 expected, tracks); | 134 expected, tracks); |
134 } | 135 } |
135 }); | 136 }); |
136 }).then(this.next, function(e) { chrome.test.fail(e); }); | 137 }).then(this.next, function(e) { chrome.test.fail(e); }); |
137 }, | 138 }, |
138 // Wait for the changes of the player status. | 139 // Wait for the changes of the player status. |
139 function() { | 140 function() { |
140 // Close window | 141 // Close window |
141 closeWindowAndWait(audioAppId).then(this.next); | 142 audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); |
142 }, | 143 }, |
143 // Wait for the audio player. | 144 // Wait for the audio player. |
144 function(result) { | 145 function(result) { |
145 chrome.test.assertTrue(result, 'Fail to close the window'); | 146 chrome.test.assertTrue(result, 'Fail to close the window'); |
146 checkIfNoErrorsOccured(this.next); | 147 checkIfNoErrorsOccured(this.next); |
147 } | 148 } |
148 ]); | 149 ]); |
149 } | 150 } |
150 | 151 |
151 /** | 152 /** |
(...skipping 27 matching lines...) Expand all Loading... |
179 waitForFileListChange(appId, expectedFilesBefore.length).then(this.next); | 180 waitForFileListChange(appId, expectedFilesBefore.length).then(this.next); |
180 }, | 181 }, |
181 function(actualFilesAfter) { | 182 function(actualFilesAfter) { |
182 chrome.test.assertEq(expectedFilesAfter, actualFilesAfter); | 183 chrome.test.assertEq(expectedFilesAfter, actualFilesAfter); |
183 callRemoteTestUtil( | 184 callRemoteTestUtil( |
184 'openFile', appId, ['Beautiful Song.ogg'], this.next); | 185 'openFile', appId, ['Beautiful Song.ogg'], this.next); |
185 }, | 186 }, |
186 // Wait for the audio player window. | 187 // Wait for the audio player window. |
187 function(result) { | 188 function(result) { |
188 chrome.test.assertTrue(result); | 189 chrome.test.assertTrue(result); |
189 waitForWindow('audio_player.html').then(this.next); | 190 audioPlayerApp.waitForWindow('audio_player.html').then(this.next); |
190 }, | 191 }, |
191 // Wait for the changes of the player status. | 192 // Wait for the changes of the player status. |
192 function(inAppId) { | 193 function(inAppId) { |
193 audioAppId = inAppId; | 194 audioAppId = inAppId; |
194 waitForElement(audioAppId, 'audio-player[playing]').then(this.next); | 195 audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). |
| 196 then(this.next); |
195 }, | 197 }, |
196 // Get the source file name. | 198 // Get the source file name. |
197 function(element) { | 199 function(element) { |
198 chrome.test.assertEq( | 200 chrome.test.assertEq( |
199 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 201 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
200 'external' + path + '/Beautiful%20Song.ogg', | 202 'external' + path + '/Beautiful%20Song.ogg', |
201 element.attributes.currenttrackurl); | 203 element.attributes.currenttrackurl); |
202 | 204 |
203 // Wait for next song. | 205 // Wait for next song. |
204 var query = 'audio-player' + | 206 var query = 'audio-player' + |
205 '[playing]' + | 207 '[playing]' + |
206 '[currenttrackurl$="newly%20added%20file.ogg"]'; | 208 '[currenttrackurl$="newly%20added%20file.ogg"]'; |
207 waitForElement(audioAppId, query).then(this.next); | 209 audioPlayerApp.waitForElement(audioAppId, query).then(this.next); |
208 }, | 210 }, |
209 // Get the source file name. | 211 // Get the source file name. |
210 function(element) { | 212 function(element) { |
211 chrome.test.assertEq( | 213 chrome.test.assertEq( |
212 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 214 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
213 'external' + path + '/newly%20added%20file.ogg', | 215 'external' + path + '/newly%20added%20file.ogg', |
214 element.attributes.currenttrackurl); | 216 element.attributes.currenttrackurl); |
215 | 217 |
216 // Close window | 218 // Close window |
217 closeWindowAndWait(audioAppId).then(this.next); | 219 audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); |
218 }, | 220 }, |
219 function(result) { | 221 function(result) { |
220 chrome.test.assertTrue(result); | 222 chrome.test.assertTrue(result); |
221 checkIfNoErrorsOccured(this.next); | 223 checkIfNoErrorsOccured(this.next); |
222 } | 224 } |
223 ]); | 225 ]); |
224 } | 226 } |
225 | 227 |
226 /** | 228 /** |
227 * Tests if the audio player play the next file after the current file. | 229 * Tests if the audio player play the next file after the current file. |
(...skipping 11 matching lines...) Expand all Loading... |
239 // Select the song. | 241 // Select the song. |
240 function(inAppId) { | 242 function(inAppId) { |
241 appId = inAppId; | 243 appId = inAppId; |
242 | 244 |
243 callRemoteTestUtil( | 245 callRemoteTestUtil( |
244 'openFile', appId, ['Beautiful Song.ogg'], this.next); | 246 'openFile', appId, ['Beautiful Song.ogg'], this.next); |
245 }, | 247 }, |
246 // Wait for the audio player window. | 248 // Wait for the audio player window. |
247 function(result) { | 249 function(result) { |
248 chrome.test.assertTrue(result); | 250 chrome.test.assertTrue(result); |
249 waitForWindow('audio_player.html').then(this.next); | 251 audioPlayerApp.waitForWindow('audio_player.html').then(this.next); |
250 }, | 252 }, |
251 // Wait for the changes of the player status. | 253 // Wait for the changes of the player status. |
252 function(inAppId) { | 254 function(inAppId) { |
253 audioAppId = inAppId; | 255 audioAppId = inAppId; |
254 waitForElement(audioAppId, 'audio-player[playing]').then(this.next); | 256 audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). |
| 257 then(this.next); |
255 }, | 258 }, |
256 // Get the source file name. | 259 // Get the source file name. |
257 function(element) { | 260 function(element) { |
258 chrome.test.assertEq( | 261 chrome.test.assertEq( |
259 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 262 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
260 'external' + path + '/Beautiful%20Song.ogg', | 263 'external' + path + '/Beautiful%20Song.ogg', |
261 element.attributes.currenttrackurl); | 264 element.attributes.currenttrackurl); |
262 | 265 |
263 callRemoteTestUtil('fakeMouseClick', | 266 audioPlayerApp.callRemoteTestUtil('fakeMouseClick', |
264 audioAppId, | 267 audioAppId, |
265 ['audio-player /deep/ button.repeat input'], | 268 ['audio-player /deep/ button.repeat input'], |
266 this.next); | 269 this.next); |
267 }, | 270 }, |
268 function(result) { | 271 function(result) { |
269 chrome.test.assertTrue(result, 'Failed to click the repeat button'); | 272 chrome.test.assertTrue(result, 'Failed to click the repeat button'); |
270 | 273 |
271 var selector = 'audio-player[playing][playcount="1"]'; | 274 var selector = 'audio-player[playing][playcount="1"]'; |
272 waitForElement(audioAppId, selector).then(this.next); | 275 audioPlayerApp.waitForElement(audioAppId, selector).then(this.next); |
273 }, | 276 }, |
274 // Get the source file name. | 277 // Get the source file name. |
275 function(element) { | 278 function(element) { |
276 chrome.test.assertEq( | 279 chrome.test.assertEq( |
277 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 280 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
278 'external' + path + '/Beautiful%20Song.ogg', | 281 'external' + path + '/Beautiful%20Song.ogg', |
279 element.attributes.currenttrackurl); | 282 element.attributes.currenttrackurl); |
280 | 283 |
281 // Close window | 284 // Close window |
282 closeWindowAndWait(audioAppId).then(this.next); | 285 audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); |
283 }, | 286 }, |
284 // Wait for the audio player. | 287 // Wait for the audio player. |
285 function(result) { | 288 function(result) { |
286 chrome.test.assertTrue(result); | 289 chrome.test.assertTrue(result); |
287 checkIfNoErrorsOccured(this.next); | 290 checkIfNoErrorsOccured(this.next); |
288 } | 291 } |
289 ]); | 292 ]); |
290 } | 293 } |
291 | 294 |
292 /** | 295 /** |
(...skipping 12 matching lines...) Expand all Loading... |
305 // Select the song. | 308 // Select the song. |
306 function(inAppId) { | 309 function(inAppId) { |
307 appId = inAppId; | 310 appId = inAppId; |
308 | 311 |
309 callRemoteTestUtil( | 312 callRemoteTestUtil( |
310 'openFile', appId, ['Beautiful Song.ogg'], this.next); | 313 'openFile', appId, ['Beautiful Song.ogg'], this.next); |
311 }, | 314 }, |
312 // Wait for the audio player window. | 315 // Wait for the audio player window. |
313 function(result) { | 316 function(result) { |
314 chrome.test.assertTrue(result); | 317 chrome.test.assertTrue(result); |
315 waitForWindow('audio_player.html').then(this.next); | 318 audioPlayerApp.waitForWindow('audio_player.html').then(this.next); |
316 }, | 319 }, |
317 // Wait for the changes of the player status. | 320 // Wait for the changes of the player status. |
318 function(inAppId) { | 321 function(inAppId) { |
319 audioAppId = inAppId; | 322 audioAppId = inAppId; |
320 waitForElement(audioAppId, 'audio-player[playing]').then(this.next); | 323 audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). |
| 324 then(this.next); |
321 }, | 325 }, |
322 // Get the source file name. | 326 // Get the source file name. |
323 function(element) { | 327 function(element) { |
324 chrome.test.assertEq( | 328 chrome.test.assertEq( |
325 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 329 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
326 'external' + path + '/Beautiful%20Song.ogg', | 330 'external' + path + '/Beautiful%20Song.ogg', |
327 element.attributes.currenttrackurl); | 331 element.attributes.currenttrackurl); |
328 | 332 |
329 var selector = 'audio-player[playcount="1"]:not([playing])'; | 333 var selector = 'audio-player[playcount="1"]:not([playing])'; |
330 waitForElement(audioAppId, selector).then(this.next); | 334 audioPlayerApp.waitForElement(audioAppId, selector).then(this.next); |
331 }, | 335 }, |
332 // Get the source file name. | 336 // Get the source file name. |
333 function(element) { | 337 function(element) { |
334 // Close window | 338 // Close window |
335 closeWindowAndWait(audioAppId).then(this.next); | 339 audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); |
336 }, | 340 }, |
337 // Wait for the audio player. | 341 // Wait for the audio player. |
338 function(result) { | 342 function(result) { |
339 chrome.test.assertTrue(result); | 343 chrome.test.assertTrue(result); |
340 checkIfNoErrorsOccured(this.next); | 344 checkIfNoErrorsOccured(this.next); |
341 } | 345 } |
342 ]); | 346 ]); |
343 } | 347 } |
344 | 348 |
345 /** | 349 /** |
(...skipping 26 matching lines...) Expand all Loading... |
372 chrome.test.assertTrue(result); | 376 chrome.test.assertTrue(result); |
373 waitForFiles(appId, expectedFilesAfter).then(this.next); | 377 waitForFiles(appId, expectedFilesAfter).then(this.next); |
374 }, | 378 }, |
375 function(/* no result */) { | 379 function(/* no result */) { |
376 callRemoteTestUtil( | 380 callRemoteTestUtil( |
377 'openFile', appId, ['newly added file.ogg'], this.next); | 381 'openFile', appId, ['newly added file.ogg'], this.next); |
378 }, | 382 }, |
379 // Wait for the audio player window. | 383 // Wait for the audio player window. |
380 function(result) { | 384 function(result) { |
381 chrome.test.assertTrue(result); | 385 chrome.test.assertTrue(result); |
382 waitForWindow('audio_player.html').then(this.next); | 386 audioPlayerApp.waitForWindow('audio_player.html').then(this.next); |
383 }, | 387 }, |
384 // Wait for the changes of the player status. | 388 // Wait for the changes of the player status. |
385 function(inAppId) { | 389 function(inAppId) { |
386 audioAppId = inAppId; | 390 audioAppId = inAppId; |
387 waitForElement(audioAppId, 'audio-player[playing]').then(this.next); | 391 audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). |
| 392 then(this.next); |
388 }, | 393 }, |
389 // Get the source file name. | 394 // Get the source file name. |
390 function(element) { | 395 function(element) { |
391 chrome.test.assertEq( | 396 chrome.test.assertEq( |
392 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 397 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
393 'external' + path + '/newly%20added%20file.ogg', | 398 'external' + path + '/newly%20added%20file.ogg', |
394 element.attributes.currenttrackurl); | 399 element.attributes.currenttrackurl); |
395 | 400 |
396 callRemoteTestUtil('fakeMouseClick', | 401 audioPlayerApp.callRemoteTestUtil('fakeMouseClick', |
397 audioAppId, | 402 audioAppId, |
398 ['audio-player /deep/ button.repeat input'], | 403 ['audio-player /deep/ button.repeat input'], |
399 this.next); | 404 this.next); |
400 }, | 405 }, |
401 function(result) { | 406 function(result) { |
402 chrome.test.assertTrue(result, 'Failed to click the repeat button'); | 407 chrome.test.assertTrue(result, 'Failed to click the repeat button'); |
403 | 408 |
404 // Wait for next song. | 409 // Wait for next song. |
405 var query = 'audio-player' + | 410 var query = 'audio-player' + |
406 '[playing]' + | 411 '[playing]' + |
407 '[currenttrackurl$="Beautiful%20Song.ogg"]'; | 412 '[currenttrackurl$="Beautiful%20Song.ogg"]'; |
408 waitForElement(audioAppId, query).then(this.next); | 413 audioPlayerApp.waitForElement(audioAppId, query).then(this.next); |
409 }, | 414 }, |
410 // Get the source file name. | 415 // Get the source file name. |
411 function(element) { | 416 function(element) { |
412 chrome.test.assertEq( | 417 chrome.test.assertEq( |
413 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 418 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
414 'external' + path + '/Beautiful%20Song.ogg', | 419 'external' + path + '/Beautiful%20Song.ogg', |
415 element.attributes.currenttrackurl); | 420 element.attributes.currenttrackurl); |
416 | 421 |
417 // Close window | 422 // Close window |
418 closeWindowAndWait(audioAppId).then(this.next); | 423 audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); |
419 }, | 424 }, |
420 // Wait for the audio player. | 425 // Wait for the audio player. |
421 function(result) { | 426 function(result) { |
422 chrome.test.assertTrue(result); | 427 chrome.test.assertTrue(result); |
423 checkIfNoErrorsOccured(this.next); | 428 checkIfNoErrorsOccured(this.next); |
424 } | 429 } |
425 ]); | 430 ]); |
426 } | 431 } |
427 | 432 |
428 /** | 433 /** |
(...skipping 26 matching lines...) Expand all Loading... |
455 chrome.test.assertTrue(result); | 460 chrome.test.assertTrue(result); |
456 waitForFiles(appId, expectedFilesAfter).then(this.next); | 461 waitForFiles(appId, expectedFilesAfter).then(this.next); |
457 }, | 462 }, |
458 function(/* no result */) { | 463 function(/* no result */) { |
459 callRemoteTestUtil( | 464 callRemoteTestUtil( |
460 'openFile', appId, ['newly added file.ogg'], this.next); | 465 'openFile', appId, ['newly added file.ogg'], this.next); |
461 }, | 466 }, |
462 // Wait for the audio player window. | 467 // Wait for the audio player window. |
463 function(result) { | 468 function(result) { |
464 chrome.test.assertTrue(result); | 469 chrome.test.assertTrue(result); |
465 waitForWindow('audio_player.html').then(this.next); | 470 audioPlayerApp.waitForWindow('audio_player.html').then(this.next); |
466 }, | 471 }, |
467 // Wait for the changes of the player status. | 472 // Wait for the changes of the player status. |
468 function(inAppId) { | 473 function(inAppId) { |
469 audioAppId = inAppId; | 474 audioAppId = inAppId; |
470 waitForElement(audioAppId, 'audio-player[playing]').then(this.next); | 475 audioPlayerApp.waitForElement(audioAppId, 'audio-player[playing]'). |
| 476 then(this.next); |
471 }, | 477 }, |
472 // Get the source file name. | 478 // Get the source file name. |
473 function(element) { | 479 function(element) { |
474 chrome.test.assertEq( | 480 chrome.test.assertEq( |
475 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | 481 'filesystem:chrome-extension://' + AUDIO_PLAYER_APP_ID + '/' + |
476 'external' + path + '/newly%20added%20file.ogg', | 482 'external' + path + '/newly%20added%20file.ogg', |
477 element.attributes.currenttrackurl); | 483 element.attributes.currenttrackurl); |
478 | 484 |
479 // Wait for next song. | 485 // Wait for next song. |
480 var query = 'audio-player:not([playing])'; | 486 var query = 'audio-player:not([playing])'; |
481 waitForElement(audioAppId, query).then(this.next); | 487 audioPlayerApp.waitForElement(audioAppId, query).then(this.next); |
482 }, | 488 }, |
483 // Get the source file name. | 489 // Get the source file name. |
484 function(element) { | 490 function(element) { |
485 // Close window | 491 // Close window |
486 closeWindowAndWait(audioAppId).then(this.next); | 492 audioPlayerApp.closeWindowAndWait(audioAppId).then(this.next); |
487 }, | 493 }, |
488 // Wait for the audio player. | 494 // Wait for the audio player. |
489 function(result) { | 495 function(result) { |
490 chrome.test.assertTrue(result); | 496 chrome.test.assertTrue(result); |
491 checkIfNoErrorsOccured(this.next); | 497 checkIfNoErrorsOccured(this.next); |
492 } | 498 } |
493 ]); | 499 ]); |
494 } | 500 } |
495 | 501 |
496 testcase.audioOpenDownloads = function() { | 502 testcase.audioOpenDownloads = function() { |
(...skipping 18 matching lines...) Expand all Loading... |
515 | 521 |
516 testcase.audioRepeatMultipleFileDrive = function() { | 522 testcase.audioRepeatMultipleFileDrive = function() { |
517 audioRepeatMultipleFile(RootPath.DRIVE); | 523 audioRepeatMultipleFile(RootPath.DRIVE); |
518 }; | 524 }; |
519 | 525 |
520 testcase.audioNoRepeatMultipleFileDrive = function() { | 526 testcase.audioNoRepeatMultipleFileDrive = function() { |
521 audioNoRepeatMultipleFile(RootPath.DRIVE); | 527 audioNoRepeatMultipleFile(RootPath.DRIVE); |
522 }; | 528 }; |
523 | 529 |
524 })(); | 530 })(); |
OLD | NEW |