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

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

Issue 399363002: Add support for writing unit tests for Mojo-backed apps/extensions APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
OLDNEW
(Empty)
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.
4
5 var test = require('test').binding;
6
7 var tests = test.runTests([
8 function testEnvironment() {
9 test.assertTrue(!!$Array);
10 test.assertTrue(!!$Function);
11 test.assertTrue(!!$JSON);
12 test.assertTrue(!!$Object);
13 test.assertTrue(!!$RegExp);
14 test.assertTrue(!!$String);
15 test.assertTrue(!!privates);
16 test.assertTrue(!!define);
17 test.assertTrue(!!require);
18 test.assertTrue(!!requireNative);
19 test.assertTrue(!!requireAsync);
20 test.assertEq(undefined, chrome.runtime.lastError);
21 test.assertEq(undefined, chrome.extension.lastError);
22 test.succeed();
23 },
24 function testPromisesRun() {
25 Promise.resolve().then(test.callbackPass());
26 },
27 function testCommonModulesAreAvailable() {
28 var binding = require('binding');
29 var binding = require('sendRequest');
30 var binding = require('lastError');
not at google - send to devlin 2014/07/18 15:09:14 by re-assigning binding each time aren't you nulli
Sam McNally 2014/07/21 03:56:28 Done.
31 test.assertTrue(!!binding);
32 test.succeed();
33 },
34 function testMojoModulesAreAvailable() {
35 Promise.all([
36 requireAsync('mojo/public/js/bindings/connection'),
37 requireAsync('mojo/public/js/bindings/core'),
38 requireAsync('content/public/renderer/service_provider'),
39 ]).then(test.callback(function(modules) {
40 var connection = modules[0];
41 var core = modules[1];
42 var serviceProvider = modules[2];
43 test.assertTrue(!!connection.Connection);
44 test.assertTrue(!!core.createMessagePipe);
45 test.assertTrue(!!serviceProvider.connectToService);
46 }));
47 },
48 ])
49 for (var testName in tests) {
50 exports[testName] = tests[testName];
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698