OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 var assertEq = chrome.test.assertEq; | 5 var assertEq = chrome.test.assertEq; |
6 var assertTrue = chrome.test.assertTrue; | 6 var assertTrue = chrome.test.assertTrue; |
7 var fail = chrome.test.fail; | 7 var fail = chrome.test.fail; |
8 var succeed = chrome.test.succeed; | 8 var succeed = chrome.test.succeed; |
9 | 9 |
10 function assertThrowsError(method, opt_expectedError) { | 10 function assertThrowsError(method, opt_expectedError) { |
(...skipping 26 matching lines...) Expand all Loading... |
37 assertThrowsError(function() {document.bgColor;}); | 37 assertThrowsError(function() {document.bgColor;}); |
38 assertThrowsError(function() {document.fgColor;}); | 38 assertThrowsError(function() {document.fgColor;}); |
39 assertThrowsError(function() {document.alinkColor;}); | 39 assertThrowsError(function() {document.alinkColor;}); |
40 assertThrowsError(function() {document.linkColor;}); | 40 assertThrowsError(function() {document.linkColor;}); |
41 assertThrowsError(function() {document.vlinkColor;}); | 41 assertThrowsError(function() {document.vlinkColor;}); |
42 | 42 |
43 succeed(); | 43 succeed(); |
44 }, | 44 }, |
45 | 45 |
46 function testHistory() { | 46 function testHistory() { |
| 47 // These are replaced by wrappers that throws exceptions. |
47 assertThrowsError(history.back); | 48 assertThrowsError(history.back); |
48 assertThrowsError(history.forward); | 49 assertThrowsError(history.forward); |
49 assertThrowsError(history.pushState); | |
50 assertThrowsError(history.replaceState); | |
51 assertThrowsError(function() {history.length;}); | 50 assertThrowsError(function() {history.length;}); |
52 assertThrowsError(function() {history.state;}); | 51 |
| 52 // These are part of the HTML5 History API that is feature detected, so we |
| 53 // remove them altogether, allowing apps to have fallback behavior. |
| 54 chrome.test.assertFalse('pushState' in history); |
| 55 chrome.test.assertFalse('replaceState' in history); |
| 56 chrome.test.assertFalse('state' in history); |
| 57 |
53 succeed(); | 58 succeed(); |
54 }, | 59 }, |
55 | 60 |
56 function testWindowFind() { | 61 function testWindowFind() { |
57 assertThrowsError(Window.prototype.find); | 62 assertThrowsError(Window.prototype.find); |
58 assertThrowsError(window.find); | 63 assertThrowsError(window.find); |
59 assertThrowsError(find); | 64 assertThrowsError(find); |
60 succeed(); | 65 succeed(); |
61 }, | 66 }, |
62 | 67 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 assertEq('undefined', typeof(chrome.extension)); | 169 assertEq('undefined', typeof(chrome.extension)); |
165 succeed(); | 170 succeed(); |
166 }, | 171 }, |
167 | 172 |
168 function testExtensionApis() { | 173 function testExtensionApis() { |
169 assertEq('undefined', typeof(chrome.tabs)); | 174 assertEq('undefined', typeof(chrome.tabs)); |
170 assertEq('undefined', typeof(chrome.windows)); | 175 assertEq('undefined', typeof(chrome.windows)); |
171 succeed(); | 176 succeed(); |
172 } | 177 } |
173 ]); | 178 ]); |
OLD | NEW |