Demo/bin/Debug/front_end/common/TestBase.js
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* Test suite for interactive UI tests.
* @constructor
* @param {Object} domAutomationController DomAutomationController instance.
*/
WebInspector.TestBase = function(domAutomationController)
{
this.domAutomationController_ = domAutomationController;
this.controlTaken_ = false;
this.timerId_ = -1;
};
/**
* Reports test failure.
* @param {string} message Failure description.
*/
WebInspector.TestBase.prototype.fail = function(message)
{
if (this.controlTaken_)
this.reportFailure_(message);
else
throw message;
};
/**
* Equals assertion tests that expected === actual.
* @param {!Object|boolean} expected Expected object.
* @param {!Object|boolean} actual Actual object.
* @param {string} opt_message User message to print if the test fails.
*/
WebInspector.TestBase.prototype.assertEquals = function(expected, actual, opt_message)
{
if (expected !== actual) {
var message = "Expected: '" + expected + "', but was '" + actual + "'";
if (opt_message)
message = opt_message + "(" + message + ")";
this.fail(message);
}
};
/**
* True assertion tests that value == true.
* @param {!Object} value Actual object.
* @param {string} opt_message User message to print if the test fails.
*/
WebInspector.TestBase.prototype.assertTrue = function(value, opt_message)
{
this.assertEquals(true, !!value, opt_message);
};
/**
* Takes control over execution.
后面还有 130 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。