Commit 0fac10b6 authored by alokp's avatar alokp Committed by Commit Bot

Reland of Moves mojo_js_integration_tests into blink. (patchset #1 id:1 of...

Reland of Moves mojo_js_integration_tests into blink. (patchset #1 id:1 of https://codereview.chromium.org/2926143002/ )

Reason for revert:
Fixed failing tests.

Original issue's description:
> Revert of Moves mojo_js_integration_tests into blink. (patchset #11 id:190001 of https://codereview.chromium.org/2734783008/ )
>
> Reason for revert:
> Seems related to webkit failures of the JsToCpp tests. E.x. https://build.chromium.org/p/chromium.webkit/builders/WebKit%20Mac10.10/builds/34530.
>
> Original issue's description:
> > Moves mojo_js_integration_tests into blink.
> >
> > BUG=699569
> >
> > Review-Url: https://codereview.chromium.org/2734783008
> > Cr-Commit-Position: refs/heads/master@{#477549}
> > Committed: https://chromium.googlesource.com/chromium/src/+/dd57fa764813de09d159a232eeef1bb21b0ccc1e
>
> TBR=jbroman@chromium.org,dpranke@chromium.org,yzshen@chromium.org,alokp@chromium.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=699569
>
> Review-Url: https://codereview.chromium.org/2926143002
> Cr-Commit-Position: refs/heads/master@{#477653}
> Committed: https://chromium.googlesource.com/chromium/src/+/6536a56d25c245bd109e32ed49240bfc04f8890f

TBR=jbroman@chromium.org,dpranke@chromium.org,yzshen@chromium.org,jwd@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=699569

Review-Url: https://codereview.chromium.org/2920383004
Cr-Commit-Position: refs/heads/master@{#478820}
parent f1e4c0cc
......@@ -15,44 +15,10 @@ import("//testing/test.gni")
group("tests") {
testonly = true
deps = [
":mojo_js_integration_tests",
":mojo_js_unittests",
]
}
test("mojo_js_integration_tests") {
deps = [
":js_to_cpp_bindings",
"//base/test:test_support",
"//gin:gin_test",
"//mojo/common",
"//mojo/edk/js",
"//mojo/edk/test:run_all_unittests",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
"//mojo/public/js:bindings",
]
sources = [
"js_to_cpp_tests.cc",
]
data = [
"js_to_cpp_tests.js",
]
configs += [ "//v8:external_startup_data" ]
}
mojom("js_to_cpp_bindings") {
sources = [
"js_to_cpp.mojom",
]
# TODO(crbug.com/699569): Convert to use the new JS bindings.
use_new_js_bindings = false
}
test("mojo_js_unittests") {
deps = [
"//base",
......
......@@ -3963,12 +3963,6 @@
},
"test": "mojo_common_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "mojo_js_integration_tests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
......@@ -4644,12 +4638,6 @@
},
"test": "mojo_common_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "mojo_js_integration_tests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
......
......@@ -232,12 +232,6 @@
},
"test": "media_blink_unittests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "mojo_js_integration_tests"
},
{
"swarming": {
"can_use_on_swarming_builders": true
......
......@@ -708,10 +708,6 @@
"label": "//mojo/common:mojo_common_unittests",
"type": "console_test_launcher",
},
"mojo_js_integration_tests": {
"label": "//mojo/edk/js/tests:mojo_js_integration_tests",
"type": "console_test_launcher",
},
"mojo_js_unittests": {
"label": "//mojo/edk/js/tests:mojo_js_unittests",
"type": "console_test_launcher",
......
......@@ -1447,6 +1447,7 @@ source_set("unit_tests") {
"//testing/gmock",
"//testing/gtest",
"//third_party/WebKit/Source/core/editing:unit_tests",
"//third_party/WebKit/Source/core/mojo:unit_tests",
]
}
......
......@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
import("//third_party/WebKit/Source/core/core.gni")
blink_core_sources("mojo") {
......@@ -23,3 +24,39 @@ blink_core_sources("mojo") {
"//services/service_manager/public/cpp",
]
}
source_set("unit_tests") {
testonly = true
sources = [
"tests/JsToCppTest.cpp",
]
data = [
"tests/JsToCppTest.js",
]
configs += [
"//third_party/WebKit/Source/core:blink_core_pch",
"//third_party/WebKit/Source:config",
"//third_party/WebKit/Source:inside_blink",
]
deps = [
":test_bindings_blink",
"//mojo/public/cpp/bindings",
"//testing/gtest",
"//third_party/WebKit/Source/core:core",
"//third_party/WebKit/Source/core:testing",
]
data_deps = [
":test_bindings", # For JS bindings: crbug.com/729649.
"//mojo/public/js:new_bindings",
]
}
mojom("test_bindings") {
sources = [
"tests/JsToCpp.mojom",
]
}
......@@ -2,26 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
define('mojo/edk/js/tests/js_to_cpp_tests', [
'console',
'mojo/edk/js/tests/js_to_cpp.mojom',
'mojo/public/js/bindings',
'mojo/public/js/connector',
'mojo/public/js/core',
], function (console, jsToCpp, bindings, connector, core) {
(function () {
var retainedJsSide;
var retainedJsSideStub;
var sampleData;
var sampleMessage;
var BAD_VALUE = 13;
var DATA_PIPE_PARAMS = {
flags: core.CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,
elementNumBytes: 1,
capacityNumBytes: 64
};
function JsSideConnection() {
this.binding = new bindings.Binding(jsToCpp.JsSide, this);
this.binding = new mojo.Binding(jsToCpp.JsSide, this);
}
JsSideConnection.prototype.setCppSide = function(cppSide) {
......@@ -55,13 +47,13 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
arg.si8 = BAD_VALUE;
for (i = 0; i < numIterations; ++i) {
dataPipe1 = core.createDataPipe(DATA_PIPE_PARAMS);
dataPipe2 = core.createDataPipe(DATA_PIPE_PARAMS);
messagePipe1 = core.createMessagePipe();
messagePipe2 = core.createMessagePipe();
dataPipe1 = Mojo.createDataPipe(DATA_PIPE_PARAMS);
dataPipe2 = Mojo.createDataPipe(DATA_PIPE_PARAMS);
messagePipe1 = Mojo.createMessagePipe();
messagePipe2 = Mojo.createMessagePipe();
arg.data_handle = dataPipe1.consumerHandle;
arg.message_handle = messagePipe1.handle1;
arg.dataHandle = dataPipe1.consumer;
arg.messageHandle = messagePipe1.handle1;
specialArg = new jsToCpp.EchoArgs();
specialArg.si64 = -1;
......@@ -69,20 +61,19 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
specialArg.si16 = -1;
specialArg.si8 = -1;
specialArg.name = 'going';
specialArg.data_handle = dataPipe2.consumerHandle;
specialArg.message_handle = messagePipe2.handle1;
specialArg.dataHandle = dataPipe2.consumer;
specialArg.messageHandle = messagePipe2.handle1;
writeDataPipe(dataPipe1, sampleData);
writeDataPipe(dataPipe2, sampleData);
writeMessagePipe(messagePipe1, sampleMessage);
writeMessagePipe(messagePipe2, sampleMessage);
this.cppSide_.echoResponse(createEchoArgsList(specialArg, arg));
core.close(dataPipe1.producerHandle);
core.close(dataPipe2.producerHandle);
core.close(messagePipe1.handle0);
core.close(messagePipe2.handle0);
dataPipe1.producer.close();
dataPipe2.producer.close();
messagePipe1.handle0.close();
messagePipe2.handle0.close();
}
this.cppSide_.testFinished();
};
......@@ -91,7 +82,7 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
var iteration = 0;
var dataPipe;
var messagePipe;
var proto = connector.Connector.prototype;
var proto = mojo.internal.Connector.prototype;
var stopSignalled = false;
proto.realAccept = proto.accept;
......@@ -110,13 +101,13 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
};
while (!stopSignalled) {
messagePipe = core.createMessagePipe();
messagePipe = Mojo.createMessagePipe();
writeMessagePipe(messagePipe, sampleMessage);
arg.message_handle = messagePipe.handle1;
arg.messageHandle = messagePipe.handle1;
this.cppSide_.bitFlipResponse(createEchoArgsList(arg), null);
core.close(messagePipe.handle0);
messagePipe.handle0.close();
iteration += 1;
}
......@@ -129,7 +120,7 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
var iteration = 0;
var dataPipe;
var messagePipe;
var proto = connector.Connector.prototype;
var proto = mojo.internal.Connector.prototype;
var stopSignalled = false;
proto.realAccept = proto.accept;
......@@ -146,13 +137,13 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
};
while (!stopSignalled) {
messagePipe = core.createMessagePipe();
messagePipe = Mojo.createMessagePipe();
writeMessagePipe(messagePipe, sampleMessage);
arg.message_handle = messagePipe.handle1;
arg.messageHandle = messagePipe.handle1;
this.cppSide_.backPointerResponse(createEchoArgsList(arg));
core.close(messagePipe.handle0);
messagePipe.handle0.close();
iteration += 1;
}
......@@ -162,10 +153,9 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
};
function writeDataPipe(pipe, data) {
var writeResult = core.writeData(
pipe.producerHandle, data, core.WRITE_DATA_FLAG_ALL_OR_NONE);
var writeResult = pipe.producer.writeData(data);
if (writeResult.result != core.RESULT_OK) {
if (writeResult.result != Mojo.RESULT_OK) {
console.log('ERROR: Data pipe write result was ' + writeResult.result);
return false;
}
......@@ -177,8 +167,8 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
}
function writeMessagePipe(pipe, arrayBuffer) {
var result = core.writeMessage(pipe.handle0, arrayBuffer, [], 0);
if (result != core.RESULT_OK) {
var result = pipe.handle0.writeMessage(arrayBuffer, []);
if (result != Mojo.RESULT_OK) {
console.log('ERROR: Message pipe write result was ' + result);
return false;
}
......@@ -212,4 +202,4 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
retainedJsSide = new JsSideConnection;
retainedJsSide.binding.bind(jsSideRequestHandle);
};
});
})();
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
......@@ -89,6 +89,12 @@ String BlinkRootDir() {
return FilePathToWebString(BlinkRootFilePath());
}
String ExecutableDir() {
base::FilePath path;
base::PathService::Get(base::DIR_EXE, &path);
return FilePathToWebString(base::MakeAbsoluteFilePath(path));
}
String WebTestDataPath(const String& relative_path) {
return FilePathToWebString(
BlinkRootFilePath()
......
......@@ -52,6 +52,9 @@ void YieldCurrentThread();
// /src/third_party/WebKit.
String BlinkRootDir();
// Returns directory containing the current executable as absolute path.
String ExecutableDir();
// Returns test data absolute path for webkit_unit_tests, i.e.
// <blinkRootDir>/Source/web/tests/data/<relativePath>.
// It returns the top web test directory if |relativePath| was not specified.
......
......@@ -119,7 +119,6 @@
'message_center_unittests',
'midi_unittests',
'mojo_common_unittests',
'mojo_js_integration_tests',
'mojo_js_unittests',
'mojo_public_bindings_unittests',
'mojo_public_system_unittests',
......@@ -276,7 +275,6 @@
'midi_unittests.exe',
'mini_installer.exe',
'mksnapshot.exe',
'mojo_js_integration_tests.exe',
'mojo_js_unittests.exe',
'mojo_message_pipe_perftests.exe',
'mojo_public_bindings_perftests.exe',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment