OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 var mediaGalleries = chrome.mediaGalleries; | |
6 | |
7 function MediaScanTest() { | |
8 var scanProgress = 'start'; | |
9 var initialGalleryCount = 0; | |
10 | |
11 function OnScanResultsAdded(galleries) { | |
12 chrome.test.assertEq(initialGalleryCount + 1, galleries.length); | |
13 chrome.test.succeed(); | |
14 } | |
15 | |
16 function OnScanProgress(details) { | |
17 chrome.test.assertEq(scanProgress, details.type); | |
18 if (scanProgress == 'start') { | |
19 scanProgress = 'finish'; | |
20 } else { | |
21 scanProgress = 'done'; | |
22 chrome.test.runWithUserGesture(function() { | |
23 mediaGalleries.addScanResults(OnScanResultsAdded); | |
24 }); | |
25 } | |
26 } | |
27 | |
28 function OnInitialMediaGalleries(galleries) { | |
29 initialGalleryCount = galleries.length; | |
30 mediaGalleries.onScanProgress.addListener(OnScanProgress); | |
31 mediaGalleries.startMediaScan(); | |
32 } | |
33 | |
34 mediaGalleries.getMediaFileSystems(OnInitialMediaGalleries); | |
35 } | |
36 | |
37 CreateDummyWindowToPreventSleep(); | |
38 | |
39 chrome.test.runTests([ | |
40 MediaScanTest, | |
41 ]); | |
OLD | NEW |