3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
7 var settingPrefix
= "test";
8 var namePrefix
= "Test snippet #";
9 var snippetStorage
= new WebInspector
.SnippetStorage(settingPrefix
, namePrefix
);
11 function dumpSnippets(snippets
)
13 for (var i
= 0; i
< snippets
.length
; ++i
) {
14 var snippet
= snippets
[i
];
15 InspectorTest
.addResult(" Snippet: id = " + snippet
.id
+ ", name = '" + snippet
.name
+ "', content = '" + snippet
.content
+ "'.");
19 function dumpSavedSnippets()
21 InspectorTest
.addResult("Dumping saved snippets:");
22 dumpSnippets(snippetStorage
._snippetsSetting
.get());
25 function dumpStorageSnippets()
27 InspectorTest
.addResult("Dumping storage snippets:");
28 dumpSnippets(snippetStorage
.snippets
);
32 dumpStorageSnippets();
33 var snippet
= snippetStorage
.createSnippet();
34 InspectorTest
.addResult("Snippet created.");
36 dumpStorageSnippets();
37 snippet
.name
= "New snippet name";
38 InspectorTest
.addResult("Snippet renamed.");
40 dumpStorageSnippets();
41 snippet
.content
= "New snippet content";
42 InspectorTest
.addResult("Snippet content changed.");
44 dumpStorageSnippets();
45 var anotherSnippet
= snippetStorage
.createSnippet();
46 InspectorTest
.addResult("Another snippet created.");
48 dumpStorageSnippets();
49 snippetStorage
.deleteSnippet(snippet
);
50 InspectorTest
.addResult("Snippet deleted.");
52 dumpStorageSnippets();
53 snippetStorage
.deleteSnippet(anotherSnippet
);
54 InspectorTest
.addResult("Another snippet deleted.");
56 dumpStorageSnippets();
58 InspectorTest
.completeTest();
62 <body onload=
"runTest()">
63 <p>Tests snippet storage.
</p>