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

Side by Side Diff: chrome/renderer/resources/extension_apitest.js

Issue 7029031: Content settings extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync & review Created 9 years, 6 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 // extension_apitest.js 5 // extension_apitest.js
6 // mini-framework for ExtensionApiTest browser tests 6 // mini-framework for ExtensionApiTest browser tests
7 7
8 var chrome = chrome || {}; 8 var chrome = chrome || {};
9 (function() { 9 (function() {
10 chrome.test = chrome.test || {}; 10 chrome.test = chrome.test || {};
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 if (!eq) 147 if (!eq)
148 return false; 148 return false;
149 } 149 }
150 for (var p in actual) { 150 for (var p in actual) {
151 if (typeof(expected[p]) == 'undefined') 151 if (typeof(expected[p]) == 'undefined')
152 return false; 152 return false;
153 } 153 }
154 return true; 154 return true;
155 }; 155 };
156 156
157 chrome.test.assertEq = function(expected, actual) { 157 chrome.test.assertEq = function(expected, actual, message) {
158 var error_msg = "API Test Error in " + testName(currentTest);
159 if (message)
160 error_msg += ": " + message;
158 if (typeof(expected) == 'object') { 161 if (typeof(expected) == 'object') {
159 if (!chrome.test.checkDeepEq(expected, actual)) { 162 if (!chrome.test.checkDeepEq(expected, actual)) {
160 chrome.test.fail("API Test Error in " + testName(currentTest) + 163 chrome.test.fail(error_msg +
161 "\nActual: " + JSON.stringify(actual) + 164 "\nActual: " + JSON.stringify(actual) +
162 "\nExpected: " + JSON.stringify(expected)); 165 "\nExpected: " + JSON.stringify(expected));
163 } 166 }
164 return; 167 return;
165 } 168 }
166 if (expected != actual) { 169 if (expected != actual) {
167 chrome.test.fail("API Test Error in " + testName(currentTest) + 170 chrome.test.fail(error_msg +
168 "\nActual: " + actual + "\nExpected: " + expected); 171 "\nActual: " + actual + "\nExpected: " + expected);
169 } 172 }
170 if (typeof(expected) != typeof(actual)) { 173 if (typeof(expected) != typeof(actual)) {
171 chrome.test.fail("API Test Error in " + testName(currentTest) + 174 chrome.test.fail(error_msg +
172 " (type mismatch)\nActual Type: " + typeof(actual) + 175 " (type mismatch)\nActual Type: " + typeof(actual) +
173 "\nExpected Type:" + typeof(expected)); 176 "\nExpected Type:" + typeof(expected));
174 } 177 }
175 }; 178 };
176 179
177 chrome.test.assertNoLastError = function() { 180 chrome.test.assertNoLastError = function() {
178 if (chrome.extension.lastError != undefined) { 181 if (chrome.extension.lastError != undefined) {
179 chrome.test.fail("lastError.message == " + 182 chrome.test.fail("lastError.message == " +
180 chrome.extension.lastError.message); 183 chrome.extension.lastError.message);
181 } 184 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 261
259 chrome.test.callbackFail = function(expectedError, func) { 262 chrome.test.callbackFail = function(expectedError, func) {
260 return chrome.test.callback(func, expectedError); 263 return chrome.test.callback(func, expectedError);
261 }; 264 };
262 265
263 chrome.test.runTests = function(tests) { 266 chrome.test.runTests = function(tests) {
264 chrome.test.tests = tests; 267 chrome.test.tests = tests;
265 chrome.test.runNextTest(); 268 chrome.test.runNextTest();
266 }; 269 };
267 })(); 270 })();
OLDNEW
« no previous file with comments | « chrome/renderer/resources/event_bindings.js ('k') | chrome/renderer/resources/extension_process_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698