1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 function createFile() {
6 webkitRequestFileSystem(window
.PERSISTENT
, 1024, gotFS
, fail
);
10 fs
.root
.getFile("hoge", {create
: true, exclusive
: false}, gotFileEntry
, fail
);
13 function gotFileEntry(entry
) {
14 entry
.createWriter(gotWriter
.bind(null, entry
), fail
);
17 function gotWriter(entry
, writer
) {
18 writer
.write(new Blob(["fuga"]));
19 writer
.onwrite
= didWrite
.bind(null, entry
);
20 writer
.onerror
= fail
;
23 function didWrite(entry
) {
24 var xhr
= new XMLHttpRequest();
25 xhr
.open("GET", entry
.toURL());
32 if (window
.chrome
&& chrome
.test
&& chrome
.test
.succeed
)
33 chrome
.test
.succeed();
34 document
.body
.innerText
= "PASS";
38 if (window
.chrome
&& chrome
.test
&& chrome
.test
.fail
)
40 document
.body
.innerText
= "FAIL";