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.
5 var mediaGalleries = chrome.mediaGalleries;
7 function MediaScanTest() {
8 var scanProgress = 'start';
9 var initialGalleryCount = 0;
11 function OnScanResultsAdded(galleries) {
12 chrome.test.assertEq(initialGalleryCount + 1, galleries.length);
13 chrome.test.succeed();
16 function OnScanProgress(details) {
17 chrome.test.assertEq(scanProgress, details.type);
18 if (scanProgress == 'start') {
19 scanProgress = 'finish';
21 scanProgress = 'done';
22 chrome.test.runWithUserGesture(function() {
23 mediaGalleries.addScanResults(OnScanResultsAdded);
28 function OnInitialMediaGalleries(galleries) {
29 initialGalleryCount = galleries.length;
30 mediaGalleries.onScanProgress.addListener(OnScanProgress);
31 mediaGalleries.startMediaScan();
34 mediaGalleries.getMediaFileSystems(OnInitialMediaGalleries);
37 CreateDummyWindowToPreventSleep();
39 chrome.test.runTests([