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

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

Issue 7558011: Finish deflaking the net-internals prerender view test and split it in two. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Update comments. 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 * @fileoverview The way these tests work is as follows: 6 * @fileoverview The way these tests work is as follows:
7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then 7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then
8 * calls the entry point for a test with RunJavascriptTest. The called 8 * calls the entry point for a test with RunJavascriptTest. The called
9 * function can then use the assert/expect functions defined in test_api.js. 9 * function can then use the assert/expect functions defined in test_api.js.
10 * All callbacks from the browser are wrapped in such a way that they can 10 * All callbacks from the browser are wrapped in such a way that they can
11 * also use the assert/expect functions. 11 * also use the assert/expect functions.
12 * 12 *
13 * A test ends when an assert/expect test fails, an exception is thrown, or 13 * A test ends when an assert/expect test fails, an exception is thrown, or
14 * |netInternalsTest.testDone| is called. At that point, or soon afterwards, 14 * |netInternalsTest.testDone| is called. At that point, or soon afterwards,
15 * the title is updated to 'Test Failed' if an assert/expect test fails, or 15 * the title is updated to 'Test Failed' if an assert/expect test fails, or
16 * there was an exception. Otherwise, it's set to 'Test Passed'. The 16 * there was an exception. Otherwise, it's set to 'Test Passed'. The
17 * behavior when an assert/expect test fails or an assertion is thrown only 17 * behavior when an assert/expect test fails or an assertion is thrown only
18 * after |netInternalsTest.testDone| is called is undefined. 18 * after |netInternalsTest.testDone| is called is undefined.
19 */ 19 */
20 20
21 // Start of namespace. 21 // Start of namespace.
22 var netInternalsTest = (function() { 22 var netInternalsTest = (function() {
23 /** 23 /**
24 * Use a shorter poll interval for tests, since a few tests wait for polled 24 * A shorter poll interval is used for tests, since a few tests wait for
25 * values to change. 25 * polled values to change.
26 * @type {number} 26 * @type {number}
27 * @const 27 * @const
28 */ 28 */
29 var TESTING_POLL_INTERVAL_MS = 50; 29 var TESTING_POLL_INTERVAL_MS = 50;
30 30
31 /** 31 /**
32 * Indicates if the test is complete. 32 * Indicates if the test is complete.
33 * @type {boolean} 33 * @type {boolean}
34 */ 34 */
35 var done = false; 35 var done = false;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 * @param {string} testName The of the test to run. 154 * @param {string} testName The of the test to run.
155 * @param {Function} testArguments The test arguments. 155 * @param {Function} testArguments The test arguments.
156 */ 156 */
157 function startNetInternalsTest(testName, testArguments) { 157 function startNetInternalsTest(testName, testArguments) {
158 // Wrap g_browser.receive around a test function so that assert and expect 158 // Wrap g_browser.receive around a test function so that assert and expect
159 // functions can be called from observers. 159 // functions can be called from observers.
160 g_browser.receive = createTestFunction('g_browser.receive', function() { 160 g_browser.receive = createTestFunction('g_browser.receive', function() {
161 BrowserBridge.prototype.receive.apply(g_browser, arguments); 161 BrowserBridge.prototype.receive.apply(g_browser, arguments);
162 }); 162 });
163 163
164 g_browser.setPollInterval(TESTING_POLL_INTERVAL_MS);
164 createTestFunction(testName, tests[testName]).apply(null, testArguments); 165 createTestFunction(testName, tests[testName]).apply(null, testArguments);
165 } 166 }
166 167
167 /** 168 /**
168 * Finds the first styled table that's a child of |parentId|, and returns the 169 * Finds the first styled table that's a child of |parentId|, and returns the
169 * number of rows it has. Returns -1 if there's no such table. 170 * number of rows it has. Returns -1 if there's no such table.
170 * @param {string} parentId HTML element id containing a styled table. 171 * @param {string} parentId HTML element id containing a styled table.
171 * @return {number} Number of rows the style table's body has. 172 * @return {number} Number of rows the style table's body has.
172 */ 173 */
173 function getStyledTableNumRows(parentId) { 174 function getStyledTableNumRows(parentId) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 HostResolverInfoObserver.prototype.onHostResolverInfoChanged = function() { 272 HostResolverInfoObserver.prototype.onHostResolverInfoChanged = function() {
272 assertNotReached(); 273 assertNotReached();
273 }; 274 };
274 275
275 // Create the observer and add it to |g_browser|. 276 // Create the observer and add it to |g_browser|.
276 g_browser.addHostResolverInfoObserver(new HostResolverInfoObserver()); 277 g_browser.addHostResolverInfoObserver(new HostResolverInfoObserver());
277 278
278 // Needed to trigger an update. 279 // Needed to trigger an update.
279 netInternalsTest.switchToView('dns'); 280 netInternalsTest.switchToView('dns');
280 }); 281 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698