Index: extensions/test/data/mojo_private_unittest.js |
diff --git a/extensions/test/data/mojo_private_unittest.js b/extensions/test/data/mojo_private_unittest.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2a90d6509240d2cda449aa21a6633784efe43a0b |
--- /dev/null |
+++ b/extensions/test/data/mojo_private_unittest.js |
@@ -0,0 +1,34 @@ |
+// Copyright 2015 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. |
+ |
+'use strict'; |
+ |
+let mojoPrivate = require('mojoPrivate').binding; |
+let test = require('test').binding; |
+let unittestBindings = require('test_environment_specific_bindings'); |
+ |
+unittestBindings.exportTests([ |
+ function testDefine() { |
+ mojoPrivate.define('testModule', [ |
+ 'mojo/public/js/codec', |
+ ], test.callbackPass(function(codec) { |
+ test.assertEq('function', typeof codec.Message); |
+ })); |
+ }, |
+ |
+ function testDefineRegistersModule() { |
+ mojoPrivate.define('testModule', ['dependency'], |
+ test.callbackPass(function(module) { |
+ test.assertEq(12345, module.result); |
+ })); |
+ mojoPrivate.define('dependency', test.callbackPass(function() { |
+ return {result: 12345}; |
+ })); |
+ }, |
+ |
+ function testDefineModuleDoesNotExist() { |
+ mojoPrivate.define('testModule', ['does not exist!'], test.fail); |
+ test.succeed(); |
+ }, |
+], test.runTests, exports); |