Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: extensions/test/data/mojo_private_unittest.js

Issue 862793003: Expose requireAsync method and make it more robust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync with master Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/resources/mojo_private_custom_bindings.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 let mojoPrivate = require('mojoPrivate').binding; 7 let mojoPrivate = require('mojoPrivate').binding;
8 let test = require('test').binding; 8 let test = require('test').binding;
9 let unittestBindings = require('test_environment_specific_bindings'); 9 let unittestBindings = require('test_environment_specific_bindings');
10 10
(...skipping 13 matching lines...) Expand all
24 })); 24 }));
25 mojoPrivate.define('dependency', test.callbackPass(function() { 25 mojoPrivate.define('dependency', test.callbackPass(function() {
26 return {result: 12345}; 26 return {result: 12345};
27 })); 27 }));
28 }, 28 },
29 29
30 function testDefineModuleDoesNotExist() { 30 function testDefineModuleDoesNotExist() {
31 mojoPrivate.define('testModule', ['does not exist!'], test.fail); 31 mojoPrivate.define('testModule', ['does not exist!'], test.fail);
32 test.succeed(); 32 test.succeed();
33 }, 33 },
34
35 function testRequireAsync() {
36 console.log('requireAsync');
37 mojoPrivate.requireAsync('mojo/public/js/codec').then(
38 test.callbackPass(function(codec) {
39 test.assertEq('function', typeof codec.Message);
40 }));
41 },
42
43 function testDefineAndRequire() {
44 mojoPrivate.define('testModule', ['dependency'],
45 test.callbackPass(function(module) {
46 test.assertEq(12345, module.result);
47 mojoPrivate.requireAsync('dependency').then(
Sam McNally 2015/01/27 04:06:28 Does this need to be inside a define()ed module?
Kevin M 2015/01/27 18:10:09 Done.
48 test.succeed,
Sam McNally 2015/01/27 04:06:28 test.callbackPass()
Kevin M 2015/01/27 18:10:09 Done.
49 test.fail);
50 }));
51 mojoPrivate.define('dependency', test.callbackPass(function() {
52 return {result: 12345};
53 }));
54 }
34 ], test.runTests, exports); 55 ], test.runTests, exports);
OLDNEW
« no previous file with comments | « extensions/renderer/resources/mojo_private_custom_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698