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

Side by Side Diff: chrome/test/data/extensions/api_test/cross_origin_xhr/background_page/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 chrome.test.getConfig(function(config) { 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this
3 3 * source code is governed by a BSD-style license that can be found in the
4 function doReq(domain, expectSuccess) { 4 * LICENSE file.
5 var req = new XMLHttpRequest(); 5 -->
6 var url = domain + ":PORT/files/extensions/test_file.txt"; 6 <script src="test.js"></script>
7 url = url.replace(/PORT/, config.testServer.port);
8
9 chrome.test.log("Requesting url: " + url);
10 req.open("GET", url, true);
11
12
13 if (expectSuccess) {
14 req.onload = function() {
15 chrome.test.assertEq(200, req.status);
16 chrome.test.assertEq("Hello!", req.responseText);
17 chrome.test.runNextTest();
18 }
19 req.onerror = function() {
20 chrome.test.log("status: " + req.status);
21 chrome.test.log("text: " + req.responseText);
22 chrome.test.fail("Unexpected error for domain: " + domain);
23 }
24 } else {
25 req.onload = function() {
26 chrome.test.fail("Unexpected success for domain: " + domain);
27 }
28 req.onerror = function() {
29 chrome.test.assertEq(0, req.status);
30 chrome.test.runNextTest();
31 }
32 }
33
34 req.send(null);
35 }
36
37 chrome.test.runTests([
38 function allowedOrigin() {
39 doReq("http://a.com", true);
40 },
41 function diallowedOrigin() {
42 doReq("http://c.com", false);
43 },
44 function allowedSubdomain() {
45 doReq("http://foo.b.com", true);
46 },
47 function noSubdomain() {
48 doReq("http://b.com", true);
49 },
50 function disallowedSubdomain() {
51 doReq("http://foob.com", false);
52 },
53 function disallowedSSL() {
54 doReq("https://a.com", false);
55 }
56 ]);
57 });
58
59 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698