Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // TODO(rdsmith) Note that SDCH has been disabled in Chrome as of M59. | |
|
eroman
2017/03/30 17:00:24
Please put this in the implementation file rather
| |
| 6 // This code is being retained for examining dumps generated before that | |
| 7 // milestone. It's probably fine to remove it in M64 or later. | |
| 8 | |
| 5 // Include test fixture. | 9 // Include test fixture. |
| 6 GEN_INCLUDE(['net_internals_test.js']); | 10 GEN_INCLUDE(['net_internals_test.js']); |
| 7 | 11 |
| 8 // Anonymous namespace | 12 // Anonymous namespace |
| 9 (function() { | 13 (function() { |
| 10 | 14 |
| 11 // Path to the page containing iframe. Iframe is used to load sdch-related | 15 // Path to the page containing iframe. Iframe is used to load sdch-related |
| 12 // content from the different origin. Otherwise favicon requests for the main | 16 // content from the different origin. Otherwise favicon requests for the main |
| 13 // page domain would spoil SDCH blacklists counters making test behavior hardly | 17 // page domain would spoil SDCH blacklists counters making test behavior hardly |
| 14 // predicatble. | 18 // predicatble. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 var tableId = SdchView.BLACKLIST_TBODY_ID; | 171 var tableId = SdchView.BLACKLIST_TBODY_ID; |
| 168 var domain = NetInternalsTest.getTbodyText(tableId, 0, 0); | 172 var domain = NetInternalsTest.getTbodyText(tableId, 0, 0); |
| 169 var reason = NetInternalsTest.getTbodyText(tableId, 0, 1); | 173 var reason = NetInternalsTest.getTbodyText(tableId, 0, 1); |
| 170 expectEquals(entry.domain, domain); | 174 expectEquals(entry.domain, domain); |
| 171 expectEquals(this.reason_, reason); | 175 expectEquals(this.reason_, reason); |
| 172 this.onTaskDone(); | 176 this.onTaskDone(); |
| 173 } | 177 } |
| 174 } | 178 } |
| 175 }; | 179 }; |
| 176 | 180 |
| 177 /** | |
| 178 * Load a page, which results in downloading a SDCH dictionary. Make sure its | |
| 179 * data is displayed. | |
| 180 */ | |
| 181 TEST_F('NetInternalsTest', 'netInternalsSdchViewFetchDictionary', function() { | |
| 182 var taskQueue = new NetInternalsTest.TaskQueue(true); | |
| 183 taskQueue.addTask( | |
| 184 new NetInternalsTest.GetTestServerURLTask( | |
| 185 BASE_PATH + encodeURI('/sdch/page.html'))); | |
| 186 taskQueue.addTask(new LoadSdchDictionaryTask()); | |
| 187 taskQueue.run(); | |
| 188 }); | |
| 189 | |
| 190 /** | |
| 191 * Load a page, get the dictionary for it, and get decoding error to see | |
| 192 * the blacklist in action. | |
| 193 */ | |
| 194 TEST_F('NetInternalsTest', 'netInternalsSdchViewBlacklistMeta', function() { | |
| 195 var taskQueue = new NetInternalsTest.TaskQueue(true); | |
| 196 taskQueue.addTask( | |
| 197 new NetInternalsTest.GetTestServerURLTask( | |
| 198 BASE_PATH + encodeURI('/sdch/page.html'))); | |
| 199 taskQueue.addTask(new LoadSdchDictionaryTask()); | |
| 200 taskQueue.addTask( | |
| 201 new NetInternalsTest.GetTestServerURLTask( | |
| 202 BASE_PATH + encodeURI('/sdch/non-html'))); | |
| 203 taskQueue.addTask( | |
| 204 new LoadPageWithDecodeErrorTask('META_REFRESH_UNSUPPORTED')); | |
| 205 taskQueue.run(); | |
| 206 }); | |
| 207 | |
| 208 /** | |
| 209 * Load a page, which is said to be SDCH-encoded, though we don't expect it. | |
| 210 */ | |
| 211 TEST_F('NetInternalsTest', 'netInternalsSdchViewBlacklistNonSdch', function() { | |
| 212 var taskQueue = new NetInternalsTest.TaskQueue(true); | |
| 213 taskQueue.addTask( | |
| 214 new NetInternalsTest.GetTestServerURLTask( | |
| 215 BASE_PATH + encodeURI('/sdch/non-sdch.html'))); | |
| 216 taskQueue.addTask( | |
| 217 new LoadPageWithDecodeErrorTask('PASSING_THROUGH_NON_SDCH')); | |
| 218 taskQueue.run(); | |
| 219 }); | |
| 220 | |
| 221 })(); // Anonymous namespace | 181 })(); // Anonymous namespace |
| OLD | NEW |