Debian Codegraph @

closure-library/closure/goog/storage/mechanism/prefixedmechanism_test.js

raw
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 goog.provide('goog.storage.mechanism.PrefixedMechanismTest');
16 goog.setTestOnly('goog.storage.mechanism.PrefixedMechanismTest');
17
18 goog.require('goog.storage.mechanism.HTML5LocalStorage');
19 goog.require('goog.storage.mechanism.PrefixedMechanism');
20 /** @suppress {extraRequire} */
21 goog.require('goog.storage.mechanism.mechanismSeparationTester');
22 /** @suppress {extraRequire} */
23 goog.require('goog.storage.mechanism.mechanismSharingTester');
24 goog.require('goog.testing.jsunit');
25
26 var submechanism = null;
27
28 function setUp() {
29 submechanism = new goog.storage.mechanism.HTML5LocalStorage();
30 if (submechanism.isAvailable()) {
31 mechanism =
32 new goog.storage.mechanism.PrefixedMechanism(submechanism, 'test');
33 mechanism_shared =
34 new goog.storage.mechanism.PrefixedMechanism(submechanism, 'test');
35 mechanism_separate =
36 new goog.storage.mechanism.PrefixedMechanism(submechanism, 'test2');
37 }
38 }
39
40 function tearDown() {
41 if (!!mechanism) {
42 mechanism.clear();
43 mechanism = null;
44 }
45 if (!!mechanism_shared) {
46 mechanism_shared.clear();
47 mechanism_shared = null;
48 }
49 if (!!mechanism_separate) {
50 mechanism_separate.clear();
51 mechanism_separate = null;
52 }
53 }
54
55 function testAvailability() {
56 if (submechanism.isAvailable()) {
57 assertNotNull(mechanism);
58 assertNotNull(mechanism_shared);
59 assertNotNull(mechanism_separate);
60 }
61 }