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

Side by Side Diff: chrome/test/data/webui/net_internals/prerender_view.js

Issue 7553009: Add some browser tests for net-internals (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months 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 // 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 /** 5 /**
6 * Tries to prerender two pages, one that will fail and one that will succeed. 6 * Tries to prerender two pages, one that will fail and one that will succeed.
7 * Checks that we see all relevant events, and update the corresponding tables. 7 * Checks that we see all relevant events, and update the corresponding tables.
8 * The prerender that will fail will briefly be active before it fails. Having 8 * The prerender that will fail will briefly be active before it fails. Having
9 * an active prerender will block another prerender from starting too soon, so 9 * an active prerender will block another prerender from starting too soon, so
10 * |failureUrl| must be prerendered first. 10 * |failureUrl| must be prerendered first.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 /** 127 /**
128 * At this point, we expect to see the failure url in the history, and the 128 * At this point, we expect to see the failure url in the history, and the
129 * successUrl in the active entry list, and the test is done. 129 * successUrl in the active entry list, and the test is done.
130 * @param {Object} prerenderInfo State of prerendering pages. 130 * @param {Object} prerenderInfo State of prerendering pages.
131 */ 131 */
132 successUrlLinked_: function(prerenderInfo) { 132 successUrlLinked_: function(prerenderInfo) {
133 assertEquals(1, prerenderInfo.history.length); 133 assertEquals(1, prerenderInfo.history.length);
134 expectEquals(this.failureUrl_, prerenderInfo.history[0].url); 134 expectEquals(this.failureUrl_, prerenderInfo.history[0].url);
135 assertEquals(1, prerenderInfo.active.length); 135 assertEquals(1, prerenderInfo.active.length);
136 expectEquals(this.successUrl_, prerenderInfo.active[0].url); 136 expectEquals(this.successUrl_, prerenderInfo.active[0].url);
137 netInternalsTest.testDone(); 137 asyncTestDone();
138 }, 138 },
139 }; 139 };
140 140
141 /** 141 /**
142 * Adds a <link rel="prerender" href="url"> to the document. 142 * Adds a <link rel="prerender" href="url"> to the document.
143 * @param {string} url URL of the page to prerender. 143 * @param {string} url URL of the page to prerender.
144 */ 144 */
145 function addPrerenderLink(url) { 145 function addPrerenderLink(url) {
146 var link = document.createElement('link'); 146 var link = document.createElement('link');
147 link.setAttribute('rel', 'prerender'); 147 link.setAttribute('rel', 'prerender');
148 link.setAttribute('href', url); 148 link.setAttribute('href', url);
149 document.body.appendChild(link); 149 document.body.appendChild(link);
150 } 150 }
151 151
152 netInternalsTest.switchToView('prerender'); 152 netInternalsTest.switchToView('prerender');
153 153
154 // Create the test observer, which will start the test once we see the initial 154 // Create the test observer, which will start the test once we see the initial
155 // onPrerenderInfoChanged event from changing the active tab. 155 // onPrerenderInfoChanged event from changing the active tab.
156 var prerenderObserver = new PrerenderTestObserver(failureUrl, successUrl); 156 var prerenderObserver = new PrerenderTestObserver(failureUrl, successUrl);
157 g_browser.addPrerenderInfoObserver(prerenderObserver); 157 g_browser.addPrerenderInfoObserver(prerenderObserver);
158 }); 158 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/net_internals/net_internals_test.js ('k') | chrome/test/data/webui/net_internals/test_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698