filesystem.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. * @fileoverview Mock filesystem object.
  16. *
  17. */
  18. goog.setTestOnly('goog.testing.fs.FileSystem');
  19. goog.provide('goog.testing.fs.FileSystem');
  20. goog.require('goog.fs.FileSystem');
  21. goog.require('goog.testing.fs.DirectoryEntry');
  22. /**
  23. * A mock filesystem object.
  24. *
  25. * @param {string=} opt_name The name of the filesystem.
  26. * @constructor
  27. * @implements {goog.fs.FileSystem}
  28. * @final
  29. */
  30. goog.testing.fs.FileSystem = function(opt_name) {
  31. /**
  32. * The name of the filesystem.
  33. * @type {string}
  34. * @private
  35. */
  36. this.name_ = opt_name || 'goog.testing.fs.FileSystem';
  37. /**
  38. * The root entry of the filesystem.
  39. * @type {!goog.testing.fs.DirectoryEntry}
  40. * @private
  41. */
  42. this.root_ = new goog.testing.fs.DirectoryEntry(this, null, '', {});
  43. };
  44. /** @override */
  45. goog.testing.fs.FileSystem.prototype.getName = function() {
  46. return this.name_;
  47. };
  48. /**
  49. * @override
  50. * @return {!goog.testing.fs.DirectoryEntry}
  51. */
  52. goog.testing.fs.FileSystem.prototype.getRoot = function() {
  53. return this.root_;
  54. };