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 StartAndCancelMediaScanTest() {
8 function StartMediaScanTest() {
9 var startEventListener = function(details
) {
10 chrome
.test
.assertEq('start', details
.type
);
11 mediaGalleries
.onScanProgress
.removeListener(startEventListener
);
12 CancelMediaScanTest();
14 mediaGalleries
.onScanProgress
.addListener(startEventListener
);
16 mediaGalleries
.startMediaScan();
19 function CancelMediaScanTest() {
20 var cancelEventListener = function(details
) {
21 chrome
.test
.assertEq('cancel', details
.type
);
22 mediaGalleries
.onScanProgress
.removeListener(cancelEventListener
);
23 chrome
.test
.succeed();
25 mediaGalleries
.onScanProgress
.addListener(cancelEventListener
);
27 mediaGalleries
.cancelMediaScan();
33 CreateDummyWindowToPreventSleep();
35 chrome
.test
.runTests([
36 StartAndCancelMediaScanTest
,