Index: experimental/c_salt/integration_tests/c_salt_tests.html |
diff --git a/experimental/c_salt/integration_tests/c_salt_tests.html b/experimental/c_salt/integration_tests/c_salt_tests.html |
deleted file mode 100644 |
index 5504b7c6bdf8dcfe94e466fa3d4b60a52875d3ae..0000000000000000000000000000000000000000 |
--- a/experimental/c_salt/integration_tests/c_salt_tests.html |
+++ /dev/null |
@@ -1,139 +0,0 @@ |
-<!DOCTYPE html> |
-<html> |
-<!-- |
-Copyright (c) 2010 The Ginsu Authors. All rights reserved. |
-Use of this source code is governed by a BSD-style license that can be |
-found in the LICENSE file. |
---> |
-<head> |
- <title>c_salt Integration Tests</title> |
- <link rel="stylesheet" type="text/css" href="jsunit/css/jsUnitStyle.css"> |
- <script type="text/javascript" src="closure/closure/goog/base.js"/> |
- <script type="text/javascript" src="jsunit/app/jsUnitCore.js"></script> |
- <script type="text/javascript"> |
- goog.require('goog.testing.jsunit'); |
- </script> |
- |
- <script type="text/javascript"> |
- c_saltIntegrationTestModule = null; // Global application object. |
- |
- function moduleDidLoad() { |
- c_saltIntegrationTestModule = document.getElementById('c_salt_integration_test'); |
- } |
- |
- // The UnaryOperations class just provides two simple unary functions. |
- function UnaryOperations() { |
- // Return the square of the given number. |
- this.square = function(x) { return x*x; } |
- // Return true if the given number is odd. |
- this.isOdd = function(x) { return x%2 ? true : false; } |
- } |
- |
- // TODO(c_salt authors): Add tests of other c_salt features here. |
- // e.g., make a PropertyTester ScriptableNativeObject, test it from |
- // a JavaScript function. |
- function testMethods() { |
- try { |
- // Get the the MethodTester for testing method marshalling behavior. |
- var methodTester = c_saltIntegrationTestModule.getMethodTester(); |
- // Call the methods and make sure the return value is correct. |
- assertEquals("Hello world!", |
- methodTester.appendStrings("Hello ", "world!")); |
- assertEquals(4.24159, |
- methodTester.addDoubles(1.1, "3.14159")); |
- assertEquals(42, |
- methodTester.addInts("30", 12)); |
- assertEquals(false, |
- methodTester.andBools(true, false)); |
- assertEquals(true, |
- methodTester.andBools("Yes", "Truck")); |
- // Create a UnaryOperations object that we will pass to methodTester |
- // to ensure it can invoke methods on JavaScript objects. |
- var x = new UnaryOperations; |
- // We should expect: |
- // methodTester.callMethodOnScriptObject("method_name", object, arg); |
- // to have the same effect as: |
- // object.method_name(arg); |
- assertEquals(x.square(4), |
- methodTester.callMethodOnScriptObject("square", x, "4")); |
- assertEquals(x.square(10), |
- methodTester.callMethodOnScriptObject("square", x, 10)); |
- assertEquals(x.square(1.7), |
- methodTester.callMethodOnScriptObject("square", x, 1.7)); |
- assertEquals(x.isOdd(10), |
- methodTester.callMethodOnScriptObject("isOdd", x, 10)); |
- assertEquals(x.isOdd(3), |
- methodTester.callMethodOnScriptObject("isOdd", x, 3)); |
- assertEquals(x.isOdd(-32), |
- methodTester.callMethodOnScriptObject("isOdd", x, -32)); |
- assertEquals('Invoked!', |
- methodTester.callAnonymousFunction(function(x) { return x; }, |
- 'Invoked!')); |
- } catch(e) { |
- fail(e.message); |
- } |
- } |
- |
- function testProperties() { |
- try { |
- // Get the the PropertyTester for testing property behavior. |
- var propertyTester = c_saltIntegrationTestModule.getPropertyTester(); |
- |
- assertEquals(42, propertyTester.intProp); |
- // intProp is immutable, so we shouldn't be able to change its value. |
- propertyTester.intProp = 10; |
- assertEquals(42, propertyTester.intProp); |
- // intProp is static, so we shouldn't be able to delete it. |
- assertEquals(false, delete propertyTester.intProp); |
- assertEquals(42, propertyTester.intProp); |
- |
- assertEquals("A string.", propertyTester.stringProp); |
- // stringProp is mutable, so we should be able to change its value. |
- propertyTester.stringProp = "A different string."; |
- assertEquals("A different string.", propertyTester.stringProp); |
- // stringProp is static, so we shouldn't be able to delete it. |
- assertEquals(false, delete propertyTester.stringProp); |
- assertEquals("A different string.", propertyTester.stringProp); |
- |
- // I should be able to add dynamic properties, and c_salt will manage |
- // them automatically. |
- propertyTester.dynamicProp = 3.1415; |
- assertEquals(3.1415, propertyTester.dynamicProp); |
- // dynamic properties are always mutable. |
- propertyTester.dynamicProp = 12345; |
- assertEquals(12345, propertyTester.dynamicProp); |
- // dynamic properties can be deleted. |
- assertEquals(true, delete propertyTester.dynamicProp); |
- assertUndefined(propertyTester.dynamicProp); |
- } |
- catch (e) { |
- fail(e.message); |
- } |
- } |
- </script> |
-</head> |
-<body> |
- <!-- Load the published .nexe. This includes the 'nexes' attribute which |
- shows how to load multi-architecture modules. Each entry in the |
- table is a key-value pair: the key is the runtime ('x86-32', |
- 'x86-64', etc.); the value is a URL for the desired NaCl module. |
- --> |
- <div id="c_salt_integration_test_content"/> |
- <script type="text/javascript"> |
- contentDiv = document.getElementById('c_salt_integration_test_content'); |
- var nexes = 'ARM: c_salt_integration_test_arm.nexe\n' |
- + 'x86-32: c_salt_integration_test_x86_32.nexe\n' |
- + 'x86-64: c_salt_integration_test_x86_64.nexe '; |
- contentDiv.innerHTML = '<embed name="nacl_module" ' |
- + 'id="c_salt_integration_test" ' |
- + 'width=0 height=0 ' |
- + 'type="application/x-nacl-srpc" ' |
- + 'onload="moduleDidLoad();" />'; |
- // Note: this code is here to work around a bug in Chromium build |
- // #47357. See also |
- // http://code.google.com/p/nativeclient/issues/detail?id=500 |
- document.getElementById('c_salt_integration_test').nexes = nexes; |
- </script> |
-</p> |
-</body> |
-</html> |