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 var expectedEventData; | 5 var expectedEventData; |
6 var capturedEventData; | 6 var capturedEventData; |
7 var shouldIgnore; | 7 var shouldIgnore; |
8 | 8 |
9 function expect(data, ignoreFunc) { | 9 function expect(data, ignoreFunc) { |
10 expectedEventData = data; | 10 expectedEventData = data; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 }, | 112 }, |
113 | 113 |
114 function faviconLoaded() { | 114 function faviconLoaded() { |
115 expect([ | 115 expect([ |
116 { status: 'loading', url: getURL('favicon/a.html') }, | 116 { status: 'loading', url: getURL('favicon/a.html') }, |
117 { status: 'complete' }, | 117 { status: 'complete' }, |
118 { favIconUrl: getURL('favicon/favicon.ico') }, | 118 { favIconUrl: getURL('favicon/favicon.ico') }, |
119 ]); | 119 ]); |
120 | 120 |
121 chrome.tabs.create({ url: getURL('favicon/a.html') }); | 121 chrome.tabs.create({ url: getURL('favicon/a.html') }); |
122 } | 122 }, |
| 123 |
| 124 function historyReplaceState() { |
| 125 expect([ |
| 126 { status: 'loading', url: getURL('historyReplaceState/a.html') }, |
| 127 { status: 'complete' }, |
| 128 { status: 'loading' }, |
| 129 { status: 'complete' }, |
| 130 ]); |
| 131 |
| 132 chrome.tabs.create({ url: getURL('historyReplaceState/a.html') }); |
| 133 }, |
| 134 |
| 135 function historyReplaceStateUpdateUrl() { |
| 136 // url status is updated. Because history.replaceState updates url. |
| 137 expect([ |
| 138 { status: 'loading', url: getURL('historyReplaceStateUpdateUrl/a.html') }, |
| 139 { status: 'complete' }, |
| 140 { status: 'loading', |
| 141 url: getURL('historyReplaceStateUpdateUrl/a.html#a') }, |
| 142 { status: 'complete' }, |
| 143 ]); |
| 144 |
| 145 chrome.tabs.create({ url: getURL('historyReplaceStateUpdateUrl/a.html') }); |
| 146 }, |
| 147 |
| 148 function historyPushState() { |
| 149 // - a.html starts loading and complete. |
| 150 // - historyPushState doesn't updates current url. |
| 151 expect([ |
| 152 { status: 'loading', url: getURL('historyPushState/a.html') }, |
| 153 { status: 'complete' }, |
| 154 { status: 'loading' }, |
| 155 { status: 'complete' }, |
| 156 ]); |
| 157 |
| 158 chrome.tabs.create({ url: getURL('historyPushState/a.html') }); |
| 159 }, |
| 160 |
| 161 function historyPushStateUpdateUrl() { |
| 162 // - a.html starts loading and complete. |
| 163 // - historyPushState updates current url. so that 'loading' and 'complete' |
| 164 // are fired with updated url. |
| 165 expect([ |
| 166 { status: 'loading', url: getURL('historyPushStateUpdateUrl/a.html') }, |
| 167 { status: 'complete' }, |
| 168 { status: 'loading', url: getURL('historyPushStateUpdateUrl/a.html#a') }, |
| 169 { status: 'complete' }, |
| 170 ]); |
| 171 |
| 172 chrome.tabs.create({ url: getURL('historyPushStateUpdateUrl/a.html') }); |
| 173 }, |
| 174 |
| 175 function locationReplace() { |
| 176 // location.replace("#foo") updates current url. so that 'loading' and |
| 177 // 'complete' are fired with updated url. |
| 178 expect([ |
| 179 { status: 'loading', url: getURL('locationReplace/a.html') }, |
| 180 { status: 'complete' }, |
| 181 { status: 'loading', url: getURL('locationReplace/a.html#foo') }, |
| 182 { status: 'complete' }, |
| 183 ]); |
| 184 |
| 185 chrome.tabs.create({ url: getURL('locationReplace/a.html') }); |
| 186 }, |
123 ]); | 187 ]); |
OLD | NEW |