123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- goog.setTestOnly('goog.testing.JsTdTestCaseAdapter');
- goog.provide('goog.testing.JsTdTestCaseAdapter');
- goog.require('goog.async.run');
- goog.require('goog.functions');
- goog.require('goog.testing.JsTdAsyncWrapper');
- goog.require('goog.testing.TestCase');
- goog.require('goog.testing.jsunit');
- goog.testing.JsTdTestCaseAdapter.TestCaseFactory_ = function(
- testCaseName, condition, opt_proto, opt_isAsync) {
-
- var T = function() {};
- if (opt_proto) T.prototype = opt_proto;
- T.displayName = testCaseName;
- goog.async.run(function() {
- var t = new T();
- if (opt_isAsync) {
- t = goog.testing.JsTdAsyncWrapper.convertToAsyncTestObj(t);
- }
- var testCase = new goog.testing.TestCase(testCaseName);
- testCase.shouldRunTests = condition;
- testCase.setTestObj(t);
- goog.testing.TestCase.initializeTestRunner(testCase);
- });
- return T;
- };
- goog.testing.JsTdTestCaseAdapter.TestCase_ = function(testCaseName, opt_proto) {
- return goog.testing.JsTdTestCaseAdapter.TestCaseFactory_(
- testCaseName, goog.functions.TRUE, opt_proto);
- };
- goog.testing.JsTdTestCaseAdapter.ConditionalTestCase_ = function(
- testCaseName, condition, opt_proto) {
- return goog.testing.JsTdTestCaseAdapter.TestCaseFactory_(
- testCaseName, condition, opt_proto);
- };
- goog.testing.JsTdTestCaseAdapter.AsyncTestCase_ = function(
- testCaseName, opt_proto) {
- return goog.testing.JsTdTestCaseAdapter.TestCaseFactory_(
- testCaseName, goog.functions.TRUE, opt_proto, true);
- };
- goog.testing.JsTdTestCaseAdapter.AsyncConditionalTestCase_ = function(
- testCaseName, condition, opt_proto) {
- return goog.testing.JsTdTestCaseAdapter.TestCaseFactory_(
- testCaseName, condition, opt_proto, true);
- };
- var TestCase = TestCase || goog.testing.JsTdTestCaseAdapter.TestCase_;
- var ConditionalTestCase = ConditionalTestCase ||
- goog.testing.JsTdTestCaseAdapter.ConditionalTestCase_;
- var AsyncTestCase =
- AsyncTestCase || goog.testing.JsTdTestCaseAdapter.AsyncTestCase_;
- var AsyncConditionalTestCase = AsyncConditionalTestCase ||
- goog.testing.JsTdTestCaseAdapter.AsyncConditionalTestCase_;
- var ConditionalAsyncTestCase = ConditionalAsyncTestCase ||
- goog.testing.JsTdTestCaseAdapter.AsyncConditionalTestCase_;
- var jstestdriver = jstestdriver || {};
- if (!jstestdriver.testCaseManager) {
-
- jstestdriver.testCaseManager = {
- TestCase: TestCase,
- ConditionalTestCase: ConditionalTestCase,
- AsyncTestCase: AsyncTestCase,
- AsyncConditionalTestCase: AsyncConditionalTestCase,
- ConditionalAsyncTestCase: ConditionalAsyncTestCase
- };
- }
|