Index: extensions/test/data/test_custom_bindings_unittest_delegate.js |
diff --git a/extensions/test/data/test_custom_bindings_unittest_delegate.js b/extensions/test/data/test_custom_bindings_unittest_delegate.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9719b1f0af266c6881752d9c01c38aef0628b5c3 |
--- /dev/null |
+++ b/extensions/test/data/test_custom_bindings_unittest_delegate.js |
@@ -0,0 +1,79 @@ |
+// 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. |
+ |
+var nativesPromise = requireAsync('testNatives'); |
+ |
+function registerHooks(api, runTests, testName) { |
+ var chromeTest = api.compiledApi; |
+ var apiFunctions = api.apiFunctions; |
+ |
+ apiFunctions.setHandleRequest('notifyPass', function() { |
+ nativesPromise.then(function(natives) { |
+ natives.NotifyPass(); |
+ }); |
+ }); |
+ |
+ apiFunctions.setHandleRequest('notifyFail', function(message) { |
+ nativesPromise.then(function(natives) { |
+ natives.NotifyFail(message); |
+ }); |
+ }); |
+ |
+ apiFunctions.setHandleRequest('log', function() { |
+ nativesPromise.then(function(natives) { |
+ natives.Log($Array.join(arguments, ' ')); |
+ }); |
+ }); |
+ |
+ apiFunctions.setHandleRequest('runTests', function(tests) { |
+ var testWrappers = {}; |
+ $Array.forEach(tests, function(test) { |
+ testWrappers[testName(test)] = function() { |
+ runTests([test]); |
+ return true; |
+ } |
+ }); |
+ return testWrappers; |
+ }); |
+ |
+ apiFunctions.setHandleRequest('runWithModuleSystem', function(callback) { |
+ throw new Error('Not implemented'); |
+ }); |
+ |
+ apiFunctions.setHandleRequest('getApiDefinitions', function() { |
+ throw new Error('Not implemented'); |
+ }); |
+ |
+ apiFunctions.setHandleRequest('getApiFeatures', function() { |
+ throw new Error('Not implemented'); |
+ }); |
+ |
+ apiFunctions.setHandleRequest('isProcessingUserGesture', function() { |
+ throw new Error('Not implemented'); |
+ }); |
+ |
+ apiFunctions.setHandleRequest('runWithUserGesture', function(callback) { |
+ throw new Error('Not implemented'); |
+ }); |
+ |
+ apiFunctions.setHandleRequest('runWithoutUserGesture', function(callback) { |
+ throw new Error('Not implemented'); |
+ }); |
+ |
+ apiFunctions.setHandleRequest('setExceptionHandler', function(callback) { |
+ chromeTest.assertEq(typeof(callback), 'function'); |
+ uncaughtExceptionHandler.setHandler(callback); |
+ }); |
+} |
+ |
+function testDone(runNextTest) { |
+ // Use a promise here to allow previous test contexts to be eligible for |
+ // garbage collection. |
+ Promise.resolve().then(function() { |
+ runNextTest(); |
+ }); |
+} |
+ |
+exports.registerHooks = registerHooks; |
+exports.testDone = testDone; |