| 1 |
// Copyright 2011 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
/** |
| 16 |
* @fileoverview Mock filesystem object. |
| 17 |
* |
| 18 |
*/ |
| 19 |
|
| 20 |
goog.setTestOnly('goog.testing.fs.FileSystem'); |
| 21 |
goog.provide('goog.testing.fs.FileSystem'); |
| 22 |
|
| 23 |
goog.require('goog.fs.FileSystem'); |
| 24 |
goog.require('goog.testing.fs.DirectoryEntry'); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
/** |
| 29 |
* A mock filesystem object. |
| 30 |
* |
| 31 |
* @param {string=} opt_name The name of the filesystem. |
| 32 |
* @constructor |
| 33 |
* @implements {goog.fs.FileSystem} |
| 34 |
* @final |
| 35 |
*/ |
| 36 |
goog.testing.fs.FileSystem = function(opt_name) { |
| 37 |
/** |
| 38 |
* The name of the filesystem. |
| 39 |
* @type {string} |
| 40 |
* @private |
| 41 |
*/ |
| 42 |
this.name_ = opt_name || 'goog.testing.fs.FileSystem'; |
| 43 |
|
| 44 |
/** |
| 45 |
* The root entry of the filesystem. |
| 46 |
* @type {!goog.testing.fs.DirectoryEntry} |
| 47 |
* @private |
| 48 |
*/ |
| 49 |
this.root_ = new goog.testing.fs.DirectoryEntry(this, null, '', {}); |
| 50 |
}; |
| 51 |
|
| 52 |
|
| 53 |
/** @override */ |
| 54 |
goog.testing.fs.FileSystem.prototype.getName = function() { |
| 55 |
return this.name_; |
| 56 |
}; |
| 57 |
|
| 58 |
|
| 59 |
/** |
| 60 |
* @override |
| 61 |
* @return {!goog.testing.fs.DirectoryEntry} |
| 62 |
*/ |
| 63 |
goog.testing.fs.FileSystem.prototype.getRoot = function() { |
| 64 |
return this.root_; |
| 65 |
}; |