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

Unified Diff: trunk/src/chrome/test/data/chromeos/liblouis_nacl/test.js

Issue 93783003: Revert 237638 "Build liblouis_nacl using gyp." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/test/data/chromeos/liblouis_nacl/test.js
===================================================================
--- trunk/src/chrome/test/data/chromeos/liblouis_nacl/test.js (revision 237669)
+++ trunk/src/chrome/test/data/chromeos/liblouis_nacl/test.js (working copy)
@@ -1,85 +0,0 @@
-// Copyright 2013 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 pass = chrome.test.callbackPass;
-
-var TABLE_NAME = 'en-us-comp8.ctb';
-var TEXT = 'hello';
-// Translation of the above string as a hexadecimal sequence of cells.
-var CELLS = '1311070715';
-
-var pendingCallback = null;
-var pendingMessageId = -1;
-var nextMessageId = 0;
-var naclEmbed = null;
-
-function loadLibrary(callback) {
- var embed = document.createElement('embed');
- embed.src = 'liblouis_nacl.nmf';
- embed.type = 'application/x-nacl';
- embed.width = 0;
- embed.height = 0;
- embed.setAttribute('tablesdir', 'tables');
- embed.addEventListener('load', function() {
- console.log("liblouis loaded");
- naclEmbed = embed;
- callback();
- }, false /* useCapture */);
- embed.addEventListener('error', function() {
- chrome.test.fail('liblouis load error');
- }, false /* useCapture */);
- embed.addEventListener('message', function(e) {
- var reply = JSON.parse(e.data);
- console.log('Message from liblouis: ' + e.data);
- pendingCallback(reply);
- }, false /* useCapture */);
- document.body.appendChild(embed);
-}
-
-
-function rpc(command, args, callback) {
- var messageId = '' + nextMessageId++;
- args['command'] = command;
- args['message_id'] = messageId;
- var json = JSON.stringify(args)
- console.log('Message to liblouis: ' + json);
- naclEmbed.postMessage(json);
- pendingCallback = callback;
- pendingMessageId = messageId;
-}
-
-
-function expectSuccessReply(callback) {
- return function(reply) {
- chrome.test.assertEq(pendingMessageId, reply['in_reply_to']);
- chrome.test.assertTrue(reply['error'] === undefined);
- chrome.test.assertTrue(reply['success']);
- if (callback) {
- callback(reply);
- }
- };
-}
-
-
-loadLibrary(function() {
- chrome.test.runTests([
- function testGetTranslator() {
- rpc('CheckTable', { 'table_name': TABLE_NAME},
- pass(expectSuccessReply()));
- },
-
- function testTranslateString() {
- rpc('Translate', { 'table_name': TABLE_NAME, 'text': TEXT},
- pass(expectSuccessReply(function(reply) {
- chrome.test.assertEq(CELLS, reply['cells']);
- })));
- },
-
- function testBackTranslateString() {
- rpc('BackTranslate', { 'table_name': TABLE_NAME, 'cells': CELLS},
- pass(expectSuccessReply(function(reply) {
- chrome.test.assertEq(TEXT, reply['text']);
- })));
- },
-])});
« no previous file with comments | « trunk/src/chrome/test/data/chromeos/liblouis_nacl/manifest.json ('k') | trunk/src/third_party/liblouis/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698