summaryrefslogtreecommitdiffstats
path: root/mojo/edk/js/tests/sample_service_tests.js
diff options
context:
space:
mode:
authorblundell <blundell@chromium.org>2015-01-19 09:18:33 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-19 17:19:27 +0000
commit70fb54767b472a5edfb859e489beeeec7abdb0e4 (patch)
tree28e534ec774391a9f6571a1770e12a0d63ebf833 /mojo/edk/js/tests/sample_service_tests.js
parentba5f0233fa38f949e24f6274ba891fa652eab640 (diff)
downloadchromium_src-70fb54767b472a5edfb859e489beeeec7abdb0e4.zip
chromium_src-70fb54767b472a5edfb859e489beeeec7abdb0e4.tar.gz
chromium_src-70fb54767b472a5edfb859e489beeeec7abdb0e4.tar.bz2
Move //mojo/{public, edk} underneath //third_party
This CL move //mojo/public and //mojo/edk to live in the following locations: - //third_party/mojo/src/mojo/public - //third_party/mojo/src/mojo/edk It moves the related gypfiles from //mojo to //third_party/mojo and updates them as necessary to account for the file moves. It also updates clients of the mojo SDK and EDK targets in both GYP and GN. (Note that for GN, the mojo SDK and EDK build systems are maintained in the Mojo repo and designed to be flexible wrt the location of the SDK/EDK in a client repo, so no changes are needed. This CL does not update include paths to the code being moved to limit the number of moving parts, instead relying on the include_dirs that the SDK and EDK targets supply to their direct dependents to ensure that include paths continue to resolve correctly. NOPRESUBMIT=true Review URL: https://codereview.chromium.org/814543006 Cr-Commit-Position: refs/heads/master@{#312129}
Diffstat (limited to 'mojo/edk/js/tests/sample_service_tests.js')
-rw-r--r--mojo/edk/js/tests/sample_service_tests.js171
1 files changed, 0 insertions, 171 deletions
diff --git a/mojo/edk/js/tests/sample_service_tests.js b/mojo/edk/js/tests/sample_service_tests.js
deleted file mode 100644
index 2afdf3e..0000000
--- a/mojo/edk/js/tests/sample_service_tests.js
+++ /dev/null
@@ -1,171 +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.
-
-define([
- "console",
- "mojo/edk/js/test/hexdump",
- "gin/test/expect",
- "mojo/public/interfaces/bindings/tests/sample_service.mojom",
- "mojo/public/interfaces/bindings/tests/sample_import.mojom",
- "mojo/public/interfaces/bindings/tests/sample_import2.mojom",
- "mojo/public/js/core",
- ], function(console, hexdump, expect, sample, imported, imported2, core) {
-
- var global = this;
-
- // Set this variable to true to print the binary message in hex.
- var dumpMessageAsHex = false;
-
- function makeFoo() {
- var bar = new sample.Bar();
- bar.alpha = 20;
- bar.beta = 40;
- bar.gamma = 60;
- bar.type = sample.Bar.Type.VERTICAL;
-
- var extra_bars = new Array(3);
- for (var i = 0; i < extra_bars.length; ++i) {
- var base = i * 100;
- var type = i % 2 ?
- sample.Bar.Type.VERTICAL : sample.Bar.Type.HORIZONTAL;
- extra_bars[i] = new sample.Bar();
- extra_bars[i].alpha = base;
- extra_bars[i].beta = base + 20;
- extra_bars[i].gamma = base + 40;
- extra_bars[i].type = type;
- }
-
- var data = new Array(10);
- for (var i = 0; i < data.length; ++i) {
- data[i] = data.length - i;
- }
-
- var source = 0xFFFF; // Invent a dummy handle.
-
- var foo = new sample.Foo();
- foo.name = "foopy";
- foo.x = 1;
- foo.y = 2;
- foo.a = false;
- foo.b = true;
- foo.c = false;
- foo.bar = bar;
- foo.extra_bars = extra_bars;
- foo.data = data;
- foo.source = source;
- return foo;
- }
-
- // Check that the given |Foo| is identical to the one made by |MakeFoo()|.
- function checkFoo(foo) {
- expect(foo.name).toBe("foopy");
- expect(foo.x).toBe(1);
- expect(foo.y).toBe(2);
- expect(foo.a).toBeFalsy();
- expect(foo.b).toBeTruthy();
- expect(foo.c).toBeFalsy();
- expect(foo.bar.alpha).toBe(20);
- expect(foo.bar.beta).toBe(40);
- expect(foo.bar.gamma).toBe(60);
- expect(foo.bar.type).toBe(sample.Bar.Type.VERTICAL);
-
- expect(foo.extra_bars.length).toBe(3);
- for (var i = 0; i < foo.extra_bars.length; ++i) {
- var base = i * 100;
- var type = i % 2 ?
- sample.Bar.Type.VERTICAL : sample.Bar.Type.HORIZONTAL;
- expect(foo.extra_bars[i].alpha).toBe(base);
- expect(foo.extra_bars[i].beta).toBe(base + 20);
- expect(foo.extra_bars[i].gamma).toBe(base + 40);
- expect(foo.extra_bars[i].type).toBe(type);
- }
-
- expect(foo.data.length).toBe(10);
- for (var i = 0; i < foo.data.length; ++i)
- expect(foo.data[i]).toBe(foo.data.length - i);
-
- expect(foo.source).toBe(0xFFFF);
- }
-
- // Check that values are set to the defaults if we don't override them.
- function checkDefaultValues() {
- var bar = new sample.Bar();
- expect(bar.alpha).toBe(255);
- expect(bar.type).toBe(sample.Bar.Type.VERTICAL);
-
- var foo = new sample.Foo();
- expect(foo.name).toBe("Fooby");
- expect(foo.a).toBeTruthy();
- expect(foo.data).toBeNull();
-
- var defaults = new sample.DefaultsTest();
- expect(defaults.a0).toBe(-12);
- expect(defaults.a1).toBe(sample.kTwelve);
- expect(defaults.a2).toBe(1234);
- expect(defaults.a3).toBe(34567);
- expect(defaults.a4).toBe(123456);
- expect(defaults.a5).toBe(3456789012);
- expect(defaults.a6).toBe(-111111111111);
- // JS doesn't have a 64 bit integer type so this is just checking that the
- // expected and actual values have the same closest double value.
- expect(defaults.a7).toBe(9999999999999999999);
- expect(defaults.a8).toBe(0x12345);
- expect(defaults.a9).toBe(-0x12345);
- expect(defaults.a10).toBe(1234);
- expect(defaults.a11).toBe(true);
- expect(defaults.a12).toBe(false);
- expect(defaults.a13).toBe(123.25);
- expect(defaults.a14).toBe(1234567890.123);
- expect(defaults.a15).toBe(1E10);
- expect(defaults.a16).toBe(-1.2E+20);
- expect(defaults.a17).toBe(1.23E-20);
- expect(defaults.a20).toBe(sample.Bar.Type.BOTH);
- expect(defaults.a21).toBeNull();
- expect(defaults.a22).toBeTruthy();
- expect(defaults.a22.shape).toBe(imported.Shape.RECTANGLE);
- expect(defaults.a22.color).toBe(imported2.Color.BLACK);
- expect(defaults.a21).toBeNull();
- expect(defaults.a23).toBe(0xFFFFFFFFFFFFFFFF);
- expect(defaults.a24).toBe(0x123456789);
- expect(defaults.a25).toBe(-0x123456789);
- }
-
- function ServiceImpl() {
- }
-
- ServiceImpl.prototype = Object.create(sample.Service.stubClass.prototype);
-
- ServiceImpl.prototype.frobinate = function(foo, baz, port) {
- checkFoo(foo);
- expect(baz).toBe(sample.Service.BazOptions.EXTRA);
- expect(core.isHandle(port)).toBeTruthy();
- global.result = "PASS";
- };
-
- function SimpleMessageReceiver() {
- }
-
- SimpleMessageReceiver.prototype.accept = function(message) {
- if (dumpMessageAsHex) {
- var uint8Array = new Uint8Array(message.buffer.arrayBuffer);
- console.log(hexdump.dumpArray(uint8Array));
- }
- // Imagine some IPC happened here.
- var serviceImpl = new ServiceImpl();
- serviceImpl.accept(message);
- };
-
- var serviceProxy = new sample.Service.proxyClass;
- serviceProxy.receiver_ = new SimpleMessageReceiver;
-
- checkDefaultValues();
-
- var foo = makeFoo();
- checkFoo(foo);
-
- var pipe = core.createMessagePipe();
- serviceProxy.frobinate(foo, sample.Service.BazOptions.EXTRA, pipe.handle0);
- expect(core.close(pipe.handle0)).toBe(core.RESULT_OK);
- expect(core.close(pipe.handle1)).toBe(core.RESULT_OK);
-});