Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / media_galleries / cancel_scan / test.js
blobaae404fb71e405bf848dd5b3631ffb93192ce108
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();
30 StartMediaScanTest();
33 CreateDummyWindowToPreventSleep();
35 chrome.test.runTests([
36 StartAndCancelMediaScanTest,
37 ]);