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

Side by Side Diff: ui/webui/resources/js/load_time_data.js

Issue 414753004: Include the document URL in the load_time_data.js expectation failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * @fileoverview This file defines a singleton which provides access to all data 6 * @fileoverview This file defines a singleton which provides access to all data
7 * that is available as soon as the page's resources are loaded (before DOM 7 * that is available as soon as the page's resources are loaded (before DOM
8 * content has finished loading). This data includes both localized strings and 8 * content has finished loading). This data includes both localized strings and
9 * any data that is important to have ready from a very early stage (e.g. things 9 * any data that is important to have ready from a very early stage (e.g. things
10 * that must be displayed right away). 10 * that must be displayed right away).
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 } 112 }
113 }; 113 };
114 114
115 /** 115 /**
116 * Checks condition, displays error message if expectation fails. 116 * Checks condition, displays error message if expectation fails.
117 * @param {*} condition The condition to check for truthiness. 117 * @param {*} condition The condition to check for truthiness.
118 * @param {string} message The message to display if the check fails. 118 * @param {string} message The message to display if the check fails.
119 */ 119 */
120 function expect(condition, message) { 120 function expect(condition, message) {
121 if (!condition) 121 if (!condition) {
122 console.error(message); 122 console.error('Unexpected condition on ' + document.location.href + ': ' +
123 message);
124 }
123 } 125 }
124 126
125 /** 127 /**
126 * Checks that the given value has the given type. 128 * Checks that the given value has the given type.
127 * @param {string} id The id of the value (only used for error message). 129 * @param {string} id The id of the value (only used for error message).
128 * @param {*} value The value to check the type on. 130 * @param {*} value The value to check the type on.
129 * @param {string} type The type we expect |value| to be. 131 * @param {string} type The type we expect |value| to be.
130 */ 132 */
131 function expectIsType(id, value, type) { 133 function expectIsType(id, value, type) {
132 expect(typeof value == type, '[' + value + '] (' + id + 134 expect(typeof value == type, '[' + value + '] (' + id +
133 ') is not a ' + type); 135 ') is not a ' + type);
134 } 136 }
135 137
136 expect(!loadTimeData, 'should only include this file once'); 138 expect(!loadTimeData, 'should only include this file once');
137 loadTimeData = new LoadTimeData; 139 loadTimeData = new LoadTimeData;
138 })(); 140 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698