Chromium Code Reviews| 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 // Include test fixture. | 5 // Include test fixture. |
| 6 GEN_INCLUDE(['net_internals_test.js']); | 6 GEN_INCLUDE(['net_internals_test.js']); |
| 7 | 7 |
| 8 // Anonymous namespace | 8 // Anonymous namespace |
| 9 (function() { | 9 (function() { |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 | 91 |
| 92 // Check number of rows in both tables. | 92 // Check number of rows in both tables. |
| 93 NetInternalsTest.checkTbodyRows(PrerenderView.HISTORY_TABLE_ID, | 93 NetInternalsTest.checkTbodyRows(PrerenderView.HISTORY_TABLE_ID, |
| 94 prerenderInfo.history.length); | 94 prerenderInfo.history.length); |
| 95 NetInternalsTest.checkTbodyRows(PrerenderView.ACTIVE_TABLE_ID, | 95 NetInternalsTest.checkTbodyRows(PrerenderView.ACTIVE_TABLE_ID, |
| 96 prerenderInfo.active.length); | 96 prerenderInfo.active.length); |
| 97 | 97 |
| 98 if (this.state_ == STATE.START_PRERENDERING) { | 98 if (this.state_ == STATE.START_PRERENDERING) { |
| 99 this.startPrerendering_(prerenderInfo); | 99 this.startPrerendering_(prerenderInfo); |
| 100 } else if (this.state_ == STATE.NEED_NAVIGATE) { | 100 } else if (this.state_ == STATE.NEED_NAVIGATE) { |
| 101 // Can't safely swap in a prerender until the main frame has committed. | |
| 102 // Waiting until the load has completed isn't necessary, but it's simpler. | |
| 103 if (!prerenderInfo.active[0].is_loaded) | |
|
eroman
2013/05/29 16:45:38
is it a given that active[0] exists?
mmenke
2013/05/29 17:11:28
Yes.
The first call to this function is when ther
| |
| 104 return; | |
| 101 this.navigate_(prerenderInfo); | 105 this.navigate_(prerenderInfo); |
| 102 } else if (this.state_ == STATE.HISTORY_WAIT) { | 106 } else if (this.state_ == STATE.HISTORY_WAIT) { |
| 103 this.checkDone_(prerenderInfo); | 107 this.checkDone_(prerenderInfo); |
| 104 } else { | 108 } else { |
| 105 assertNotReached(); | 109 assertNotReached(); |
| 106 } | 110 } |
| 107 }, | 111 }, |
| 108 | 112 |
| 109 /** | 113 /** |
| 110 * Start by triggering a prerender of |url_| in a background tab. | 114 * Start by triggering a prerender of |url_| in a background tab. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 */ | 197 */ |
| 194 TEST_F('NetInternalsTest', 'netInternalsPrerenderViewFail', function() { | 198 TEST_F('NetInternalsTest', 'netInternalsPrerenderViewFail', function() { |
| 195 var taskQueue = new NetInternalsTest.TaskQueue(true); | 199 var taskQueue = new NetInternalsTest.TaskQueue(true); |
| 196 taskQueue.addTask( | 200 taskQueue.addTask( |
| 197 new NetInternalsTest.GetTestServerURLTask('files/download-test1.lib')); | 201 new NetInternalsTest.GetTestServerURLTask('files/download-test1.lib')); |
| 198 taskQueue.addTask(new PrerenderTask(false, 'Download')); | 202 taskQueue.addTask(new PrerenderTask(false, 'Download')); |
| 199 taskQueue.run(); | 203 taskQueue.run(); |
| 200 }); | 204 }); |
| 201 | 205 |
| 202 })(); // Anonymous namespace | 206 })(); // Anonymous namespace |
| OLD | NEW |