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

Side by Side Diff: chrome/test/data/extensions/api_test/file_system_provider/mount/test.js

Issue 192573002: [fsp] Introduce file_system_provider::Service class for the FileSystemProvider API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 chrome.test.runTests([ 5 chrome.test.runTests([
6 function goodDisplayName() { 6 function goodDisplayName() {
7 chrome.fileSystemProvider.mount( 7 chrome.fileSystemProvider.mount(
8 'test file system', 8 'test file system',
9 function(fileSystemId) { 9 function(fileSystemId) {
10 chrome.test.assertEq('string', typeof(fileSystemId)); 10 chrome.test.assertEq('string', typeof(fileSystemId));
11 chrome.test.assertTrue(fileSystemId != ''); 11 chrome.test.assertTrue(fileSystemId != '');
12 chrome.test.succeed(); 12 chrome.test.succeed();
13 }, 13 },
14 function(error) { 14 function(error) {
15 chrome.test.fail(); 15 chrome.test.fail();
16 } 16 }
17 ); 17 );
18 }, 18 },
19
19 function emptyDisplayName() { 20 function emptyDisplayName() {
20 chrome.fileSystemProvider.mount( 21 chrome.fileSystemProvider.mount(
21 '', 22 '',
22 function(fileSystemId) { 23 function(fileSystemId) {
23 chrome.test.fail(); 24 chrome.test.fail();
24 }, 25 },
25 function(error) { 26 function(error) {
26 chrome.test.assertEq('SecurityError', error.name); 27 chrome.test.assertEq('SecurityError', error.name);
27 chrome.test.succeed(); 28 chrome.test.succeed();
28 } 29 }
29 ); 30 );
30 }, 31 },
32
33 function successfulMount() {
34 chrome.fileSystemProvider.mount(
35 'caramel-candy.zip',
36 function(fileSystemId) {
37 chrome.test.assertTrue(fileSystemId != '');
38 chrome.fileBrowserPrivate.getVolumeMetadataList(function(volumeList) {
39 var found = volumeList.filter(function(volumeInfo) {
40 return volumeInfo.volumeId == 'provided:' + fileSystemId;
41 });
42 chrome.test.assertEq(1, found.length);
43 chrome.test.succeed();
44 });
45 },
46 function(error) {
47 chrome.test.fail();
48 });
49 },
50
51 function stressMountTest() {
satorux1 2014/03/26 07:55:37 nice test!
mtomasz 2014/03/26 09:21:43 Thx!
52 // Try to create more than allowed number of file systems. All of the mount
53 // requests should succeed, except the last one which should fail with a
54 // security error.
55 var ALREADY_MOUNTED_FILE_SYSTEMS = 2; // By previous tests.
56 var MAX_FILE_SYSTEMS = 16;
57 var index = 0;
58 var tryNextOne = function() {
59 index++;
60 if (index < MAX_FILE_SYSTEMS - ALREADY_MOUNTED_FILE_SYSTEMS + 1) {
61 chrome.fileSystemProvider.mount(
62 index + 'th file system',
63 function(fileSystemId) {
64 chrome.test.assertTrue(fileSystemId != '');
65 tryNextOne();
66 },
67 chrome.test.fail);
68 } else {
69 chrome.fileSystemProvider.mount(
70 'over the limit fs',
71 chrome.test.fail,
72 function(error) {
73 chrome.test.assertEq('SecurityError', error.name);
74 chrome.test.succeed();
75 });
76 }
77 };
78 tryNextOne();
79 }
31 ]); 80 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698