file.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 file object.
  16. *
  17. */
  18. goog.setTestOnly('goog.testing.fs.File');
  19. goog.provide('goog.testing.fs.File');
  20. goog.require('goog.testing.fs.Blob');
  21. /**
  22. * A mock file object.
  23. *
  24. * @param {string} name The name of the file.
  25. * @param {Date=} opt_lastModified The last modified date for this file. May be
  26. * null if file modification dates are not supported.
  27. * @param {string=} opt_data The string data encapsulated by the blob.
  28. * @param {string=} opt_type The mime type of the blob.
  29. * @constructor
  30. * @extends {goog.testing.fs.Blob}
  31. * @final
  32. */
  33. goog.testing.fs.File = function(name, opt_lastModified, opt_data, opt_type) {
  34. goog.testing.fs.File.base(this, 'constructor', opt_data, opt_type);
  35. /**
  36. * @see http://www.w3.org/TR/FileAPI/#dfn-name
  37. * @type {string}
  38. */
  39. this.name = name;
  40. /**
  41. * @see http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate
  42. * @type {Date}
  43. */
  44. this.lastModifiedDate = opt_lastModified || null;
  45. };
  46. goog.inherits(goog.testing.fs.File, goog.testing.fs.Blob);