| OLD | NEW |
| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Runs all of the test cases, one by one. | 8 * Runs all of the test cases, one by one. |
| 9 */ | 9 */ |
| 10 chrome.test.runTests([ | 10 chrome.test.runTests([ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 }, | 45 }, |
| 46 function(error) { | 46 function(error) { |
| 47 chrome.test.assertEq('SecurityError', error.name); | 47 chrome.test.assertEq('SecurityError', error.name); |
| 48 onTestSuccess(); | 48 onTestSuccess(); |
| 49 } | 49 } |
| 50 ); | 50 ); |
| 51 }, | 51 }, |
| 52 | 52 |
| 53 // End to end test. Mounts a volume using fileSystemProvider.mount(), then | 53 // End to end test. Mounts a volume using fileSystemProvider.mount(), then |
| 54 // checks if the mounted volume is added to VolumeManager, by querying | 54 // checks if the mounted volume is added to VolumeManager, by querying |
| 55 // fileBrowserPrivate.getVolumeMetadataList(). | 55 // fileManagerPrivate.getVolumeMetadataList(). |
| 56 function successfulMount() { | 56 function successfulMount() { |
| 57 var onTestSuccess = chrome.test.callbackPass(); | 57 var onTestSuccess = chrome.test.callbackPass(); |
| 58 var fileSystemId = 'caramel-candy'; | 58 var fileSystemId = 'caramel-candy'; |
| 59 chrome.fileSystemProvider.mount( | 59 chrome.fileSystemProvider.mount( |
| 60 {fileSystemId: fileSystemId, displayName: 'caramel-candy.zip'}, | 60 {fileSystemId: fileSystemId, displayName: 'caramel-candy.zip'}, |
| 61 function() { | 61 function() { |
| 62 chrome.fileBrowserPrivate.getVolumeMetadataList(function(volumeList) { | 62 chrome.fileManagerPrivate.getVolumeMetadataList(function(volumeList) { |
| 63 var volumeInfo; | 63 var volumeInfo; |
| 64 volumeList.forEach(function(inVolumeInfo) { | 64 volumeList.forEach(function(inVolumeInfo) { |
| 65 if (inVolumeInfo.extensionId == chrome.runtime.id && | 65 if (inVolumeInfo.extensionId == chrome.runtime.id && |
| 66 inVolumeInfo.fileSystemId == fileSystemId) { | 66 inVolumeInfo.fileSystemId == fileSystemId) { |
| 67 volumeInfo = inVolumeInfo; | 67 volumeInfo = inVolumeInfo; |
| 68 } | 68 } |
| 69 }); | 69 }); |
| 70 chrome.test.assertTrue(!!volumeInfo); | 70 chrome.test.assertTrue(!!volumeInfo); |
| 71 chrome.test.assertTrue(volumeInfo.isReadOnly); | 71 chrome.test.assertTrue(volumeInfo.isReadOnly); |
| 72 onTestSuccess(); | 72 onTestSuccess(); |
| 73 }); | 73 }); |
| 74 }, | 74 }, |
| 75 function(error) { | 75 function(error) { |
| 76 chrome.test.fail(); | 76 chrome.test.fail(); |
| 77 }); | 77 }); |
| 78 }, | 78 }, |
| 79 | 79 |
| 80 // Checks whether mounting a file system in writable mode ends up on filling | 80 // Checks whether mounting a file system in writable mode ends up on filling |
| 81 // out the volume info properly. | 81 // out the volume info properly. |
| 82 function successfulWritableMount() { | 82 function successfulWritableMount() { |
| 83 var onTestSuccess = chrome.test.callbackPass(); | 83 var onTestSuccess = chrome.test.callbackPass(); |
| 84 var fileSystemId = 'caramel-fudges'; | 84 var fileSystemId = 'caramel-fudges'; |
| 85 chrome.fileSystemProvider.mount( | 85 chrome.fileSystemProvider.mount( |
| 86 { | 86 { |
| 87 fileSystemId: fileSystemId, | 87 fileSystemId: fileSystemId, |
| 88 displayName: 'caramel-fudges.zip', | 88 displayName: 'caramel-fudges.zip', |
| 89 writable: true | 89 writable: true |
| 90 }, | 90 }, |
| 91 function() { | 91 function() { |
| 92 chrome.fileBrowserPrivate.getVolumeMetadataList(function(volumeList) { | 92 chrome.fileManagerPrivate.getVolumeMetadataList(function(volumeList) { |
| 93 var volumeInfo; | 93 var volumeInfo; |
| 94 volumeList.forEach(function(inVolumeInfo) { | 94 volumeList.forEach(function(inVolumeInfo) { |
| 95 if (inVolumeInfo.extensionId == chrome.runtime.id && | 95 if (inVolumeInfo.extensionId == chrome.runtime.id && |
| 96 inVolumeInfo.fileSystemId == fileSystemId) { | 96 inVolumeInfo.fileSystemId == fileSystemId) { |
| 97 volumeInfo = inVolumeInfo; | 97 volumeInfo = inVolumeInfo; |
| 98 } | 98 } |
| 99 }); | 99 }); |
| 100 chrome.test.assertTrue(!!volumeInfo); | 100 chrome.test.assertTrue(!!volumeInfo); |
| 101 chrome.test.assertFalse(volumeInfo.isReadOnly); | 101 chrome.test.assertFalse(volumeInfo.isReadOnly); |
| 102 onTestSuccess(); | 102 onTestSuccess(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 }, | 139 }, |
| 140 function(error) { | 140 function(error) { |
| 141 chrome.test.assertEq('SecurityError', error.name); | 141 chrome.test.assertEq('SecurityError', error.name); |
| 142 onTestSuccess(); | 142 onTestSuccess(); |
| 143 }); | 143 }); |
| 144 } | 144 } |
| 145 }; | 145 }; |
| 146 tryNextOne(); | 146 tryNextOne(); |
| 147 } | 147 } |
| 148 ]); | 148 ]); |
| OLD | NEW |