Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: chrome/test/data/extensions/api_test/xhr_persistent_fs/main.js

Issue 10969017: Create a new URLRequestJobFactory for isolated request contexts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ordering Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 function createFile() {
6 webkitRequestFileSystem(window.PERSISTENT, 1024, gotFS, fail);
7 };
8
9 function gotFS(fs) {
10 fs.root.getFile("hoge", {create: true, exclusive: false}, gotFileEntry, fail);
11 }
12
13 function gotFileEntry(entry) {
14 entry.createWriter(gotWriter.bind(null, entry), fail);
15 }
16
17 function gotWriter(entry, writer) {
18 writer.write(new Blob(["fuga"]));
19 writer.onwrite = didWrite.bind(null, entry);
20 writer.onerror = fail;
21 }
22
23 function didWrite(entry) {
24 var xhr = new XMLHttpRequest();
25 xhr.open("GET", entry.toURL());
26 xhr.send();
27 xhr.onload = pass;
28 xhr.onerror = fail;
29 }
30
31 function pass() {
32 if (window.chrome && chrome.test && chrome.test.succeed)
33 chrome.test.succeed();
34 document.body.innerText = "PASS";
35 }
36
37 function fail() {
38 if (window.chrome && chrome.test && chrome.test.fail)
39 chrome.test.fail();
40 document.body.innerText = "FAIL";
41 }
42
43 createFile();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698