OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The id of the extension we're using for install tests. | 5 // The id of the extension we're using for install tests. |
6 var extensionId = "enfkhcelefdadlmkffamgdlgplcionje"; | 6 var extensionId = "enfkhcelefdadlmkffamgdlgplcionje"; |
7 | 7 |
8 var assertEq = chrome.test.assertEq; | 8 var assertEq = chrome.test.assertEq; |
9 var assertNoLastError = chrome.test.assertNoLastError; | 9 var assertNoLastError = chrome.test.assertNoLastError; |
10 var callbackFail = chrome.test.callbackFail; | 10 var callbackFail = chrome.test.callbackFail; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // Strip the data url prefix to just get the base64-encoded bytes. | 42 // Strip the data url prefix to just get the base64-encoded bytes. |
43 cachedIcon = tmp.slice(tmp.search(",")+1); | 43 cachedIcon = tmp.slice(tmp.search(",")+1); |
44 callback(cachedIcon); | 44 callback(cachedIcon); |
45 }; | 45 }; |
46 img.src = "extension/icon.png"; | 46 img.src = "extension/icon.png"; |
47 } | 47 } |
48 | 48 |
49 var cachedManifest = null; | 49 var cachedManifest = null; |
50 | 50 |
51 // This returns the string contents of the extension's manifest file. | 51 // This returns the string contents of the extension's manifest file. |
52 function getManifest() { | 52 function getManifest(alternativePath) { |
53 if (cachedManifest) | 53 if (cachedManifest) |
54 return cachedManifest; | 54 return cachedManifest; |
55 | 55 |
56 // Do a synchronous XHR to get the manifest. | 56 // Do a synchronous XHR to get the manifest. |
57 var xhr = new XMLHttpRequest(); | 57 var xhr = new XMLHttpRequest(); |
58 xhr.open("GET", "extension/manifest.json", false); | 58 xhr.open("GET", |
| 59 alternativePath ? alternativePath : "extension/manifest.json", |
| 60 false); |
59 xhr.send(null); | 61 xhr.send(null); |
60 return xhr.responseText; | 62 return xhr.responseText; |
61 } | 63 } |
OLD | NEW |