Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/test/data/extensions/api_test/media_galleries/access_attached/test.js

Issue 24242010: Media Galleries: Refactor test to not need RunSecondPhase(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var mediaGalleries = chrome.mediaGalleries; 5 var mediaGalleries = chrome.mediaGalleries;
6 6
7 var galleries; 7 var galleries;
8 var testResults = []; 8 var testResults = [];
9 9 var expectedFileSystems;
10 function testGalleries(expectedFileSystems, testGalleryName) { 10 var testGalleryName;
11 chrome.test.assertEq(expectedFileSystems, galleries.length);
12
13 for (var i = 0; i < galleries.length; i++) {
14 var metadata = mediaGalleries.getMediaFileSystemMetadata(galleries[i]);
15 if (metadata.name == testGalleryName) {
16 chrome.test.succeed();
17 return;
18 } else {
19 testResults.push(metadata.name);
20 }
21 }
22 chrome.test.fail(testResults + ' vs ' + testGalleryName);
23 };
24 11
25 var mediaFileSystemsListCallback = function(results) { 12 var mediaFileSystemsListCallback = function(results) {
26 galleries = results; 13 galleries = results;
27 }; 14 };
28 15
29 chrome.test.runTests([ 16 chrome.test.getConfig(function(config) {
30 function mediaGalleriesAccessAttached() { 17 customArg = JSON.parse(config.customArg);
31 mediaGalleries.getMediaFileSystems( 18 expectedFileSystems = customArg[0];
32 chrome.test.callbackPass(mediaFileSystemsListCallback)); 19 testGalleryName = customArg[1];
33 }, 20
34 ]); 21 chrome.test.runTests([
22 function mediaGalleriesAccessAttached() {
23 mediaGalleries.getMediaFileSystems(
24 chrome.test.callbackPass(mediaFileSystemsListCallback));
25 },
26 function testGalleries() {
27 chrome.test.assertEq(expectedFileSystems, galleries.length);
28
29 for (var i = 0; i < galleries.length; i++) {
30 var metadata = mediaGalleries.getMediaFileSystemMetadata(galleries[i]);
31 if (metadata.name == testGalleryName) {
32 chrome.test.succeed();
33 return;
34 } else {
35 testResults.push(metadata.name);
36 }
37 }
38 chrome.test.fail(testResults + ' vs ' + testGalleryName);
39 },
40 ]);
41 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698