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

Side by Side Diff: chrome/test/data/extensions/api_test/cross_origin_xhr/all_urls/test.html

Issue 8725019: Move another bunch of extension API tests to manifest_version 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
1 <script> 1 <!--
2 // Tab where the content script has been injected. 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this
3 var testTabId; 3 * source code is governed by a BSD-style license that can be found in the
4 4 * LICENSE file.
5 var pass = chrome.test.callbackPass; 5 -->
6 6 <script src="test.js"></script>
7 chrome.test.getConfig(function(config) {
8
9 function rewriteURL(url) {
10 return url.replace(/PORT/, config.testServer.port);
11 }
12
13 function doReq(domain, expectSuccess) {
14 var url = rewriteURL(domain + ':PORT/files/extensions/test_file.txt');
15
16 chrome.tabs.sendRequest(testTabId, url, pass(function(response) {
17 if (expectSuccess) {
18 chrome.test.assertEq('load', response.event);
19 chrome.test.assertEq(200, response.status);
20 chrome.test.assertEq('Hello!', response.text);
21 } else {
22 chrome.test.assertEq(0, response.status);
23 }
24 }));
25 }
26
27 chrome.tabs.create({
28 url: rewriteURL('http://localhost:PORT/files/extensions/test_file.html')},
29 function(tab) {
30 testTabId = tab.id;
31 });
32
33 chrome.extension.onRequest.addListener(function(message) {
34 chrome.test.assertEq('injected', message);
35
36 chrome.test.runTests([
37 function domainOne() {
38 doReq('http://a.com', true);
39 },
40 function domainTwo() {
41 doReq('http://c.com', true);
42 }
43 ]);
44 });
45 });
46
47 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698