1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 var nativesPromise = requireAsync('testNatives');
7 function registerHooks(api) {
8 var chromeTest = api.compiledApi;
9 var apiFunctions = api.apiFunctions;
11 apiFunctions.setHandleRequest('notifyPass', function() {
12 nativesPromise.then(function(natives) {
17 apiFunctions.setHandleRequest('notifyFail', function(message) {
18 nativesPromise.then(function(natives) {
19 natives.NotifyFail(message);
23 apiFunctions.setHandleRequest('log', function() {
24 nativesPromise.then(function(natives) {
25 natives.Log($Array.join(arguments, ' '));
31 function testDone(runNextTest) {
32 // Use a promise here to allow previous test contexts to be eligible for
33 // garbage collection.
34 Promise.resolve().then(function() {
39 function exportTests(tests, runTests, exports) {
40 $Array.forEach(tests, function(test) {
41 exports[test.name] = function() {
48 exports.registerHooks = registerHooks;
49 exports.testDone = testDone;
50 exports.exportTests = exportTests;