| 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 StartAndCancelMediaScanTest() { | |
| 8 function StartMediaScanTest() { | |
| 9 var startEventListener = function(details) { | |
| 10 chrome.test.assertEq('start', details.type); | |
| 11 mediaGalleries.onScanProgress.removeListener(startEventListener); | |
| 12 CancelMediaScanTest(); | |
| 13 } | |
| 14 mediaGalleries.onScanProgress.addListener(startEventListener); | |
| 15 | |
| 16 mediaGalleries.startMediaScan(); | |
| 17 } | |
| 18 | |
| 19 function CancelMediaScanTest() { | |
| 20 var cancelEventListener = function(details) { | |
| 21 chrome.test.assertEq('cancel', details.type); | |
| 22 mediaGalleries.onScanProgress.removeListener(cancelEventListener); | |
| 23 chrome.test.succeed(); | |
| 24 }; | |
| 25 mediaGalleries.onScanProgress.addListener(cancelEventListener); | |
| 26 | |
| 27 mediaGalleries.cancelMediaScan(); | |
| 28 } | |
| 29 | |
| 30 StartMediaScanTest(); | |
| 31 } | |
| 32 | |
| 33 CreateDummyWindowToPreventSleep(); | |
| 34 | |
| 35 chrome.test.runTests([ | |
| 36 StartAndCancelMediaScanTest, | |
| 37 ]); | |
| OLD | NEW |