mechanismfactory_test.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. goog.provide('goog.storage.mechanism.mechanismfactoryTest');
  15. goog.setTestOnly('goog.storage.mechanism.mechanismfactoryTest');
  16. goog.require('goog.storage.mechanism.mechanismfactory');
  17. goog.require('goog.testing.jsunit');
  18. function setUp() {
  19. mechanism = goog.storage.mechanism.mechanismfactory.create('test');
  20. mechanism_shared = goog.storage.mechanism.mechanismfactory.create('test');
  21. mechanism_separate = goog.storage.mechanism.mechanismfactory.create('test2');
  22. }
  23. function tearDown() {
  24. if (!!mechanism) {
  25. mechanism.clear();
  26. mechanism = null;
  27. }
  28. if (!!mechanism_shared) {
  29. mechanism_shared.clear();
  30. mechanism_shared = null;
  31. }
  32. if (!!mechanism_separate) {
  33. mechanism_separate.clear();
  34. mechanism_separate = null;
  35. }
  36. }
  37. function testAvailability() {
  38. var probe = goog.storage.mechanism.mechanismfactory.create();
  39. if (!!probe) {
  40. assertNotNull(mechanism);
  41. assertNotNull(mechanism_shared);
  42. assertNotNull(mechanism_separate);
  43. }
  44. }