Commit 26834276 authored by Alok Priyadarshi's avatar Alok Priyadarshi Committed by Commit Bot

Reland of "Moves mojo_js_integration_tests into blink."

This reverts commit c461e58e.

Reason for revert: JsToCpp.mojom.js should now be available on android devices when running webkit_unit_tests: https://chromium-review.googlesource.com/c/540085/

Original change's description:
> Revert "Reland of Moves mojo_js_integration_tests into blink. (patchset #1 id:1 of https://codereview.chromium.org/2939663002/ )"
>
> Reason for revert:
> WebKit Android (Nexus4) are still broken with four failing tests:
>   JsToCppTest.BackPointer
>   JsToCppTest.BitFlip
>   JsToCppTest.Ping
>   JsToCppTest.Echo
>
> TBR=jbroman@chromium.org,dpranke@chromium.org,yzshen@chromium.org,jwd@chromium.org,alokp@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=699569
>
> Change-Id: I925840dbe50bd21e6c87b03f23d6b4007d27df63
> Reviewed-on: https://chromium-review.googlesource.com/538520
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Daniel Cheng <dcheng@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#480282}

TBR=dcheng@chromium.org,jwd@chromium.org,jbroman@chromium.org,dpranke@chromium.org,yzshen@chromium.org,agrieve@chromium.org,alokp@chromium.org

Bug: 699569
Change-Id: I59bcce1f0a4f650eedaea7cce999b650041e7506
Reviewed-on: https://chromium-review.googlesource.com/540664
Commit-Queue: Alok Priyadarshi <alokp@chromium.org>
Reviewed-by: default avatarAlok Priyadarshi <alokp@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#481712}
parent d3bd31fd
...@@ -15,48 +15,10 @@ import("//testing/test.gni") ...@@ -15,48 +15,10 @@ import("//testing/test.gni")
group("tests") { group("tests") {
testonly = true testonly = true
deps = [ deps = [
":mojo_js_integration_tests",
":mojo_js_unittests", ":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",
]
data_deps = [
":js_to_cpp_bindings_js_data_deps",
]
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") { test("mojo_js_unittests") {
deps = [ deps = [
"//base", "//base",
......
...@@ -3996,12 +3996,6 @@ ...@@ -3996,12 +3996,6 @@
}, },
"test": "mojo_common_unittests" "test": "mojo_common_unittests"
}, },
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "mojo_js_integration_tests"
},
{ {
"swarming": { "swarming": {
"can_use_on_swarming_builders": true "can_use_on_swarming_builders": true
...@@ -4677,12 +4671,6 @@ ...@@ -4677,12 +4671,6 @@
}, },
"test": "mojo_common_unittests" "test": "mojo_common_unittests"
}, },
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "mojo_js_integration_tests"
},
{ {
"swarming": { "swarming": {
"can_use_on_swarming_builders": true "can_use_on_swarming_builders": true
......
...@@ -232,12 +232,6 @@ ...@@ -232,12 +232,6 @@
}, },
"test": "media_blink_unittests" "test": "media_blink_unittests"
}, },
{
"swarming": {
"can_use_on_swarming_builders": true
},
"test": "mojo_js_integration_tests"
},
{ {
"swarming": { "swarming": {
"can_use_on_swarming_builders": true "can_use_on_swarming_builders": true
......
...@@ -712,10 +712,6 @@ ...@@ -712,10 +712,6 @@
"label": "//mojo/common:mojo_common_unittests", "label": "//mojo/common:mojo_common_unittests",
"type": "console_test_launcher", "type": "console_test_launcher",
}, },
"mojo_js_integration_tests": {
"label": "//mojo/edk/js/tests:mojo_js_integration_tests",
"type": "console_test_launcher",
},
"mojo_js_unittests": { "mojo_js_unittests": {
"label": "//mojo/edk/js/tests:mojo_js_unittests", "label": "//mojo/edk/js/tests:mojo_js_unittests",
"type": "console_test_launcher", "type": "console_test_launcher",
......
...@@ -1506,6 +1506,7 @@ source_set("unit_tests") { ...@@ -1506,6 +1506,7 @@ source_set("unit_tests") {
"//testing/gmock", "//testing/gmock",
"//testing/gtest", "//testing/gtest",
"//third_party/WebKit/Source/core/editing:unit_tests", "//third_party/WebKit/Source/core/editing:unit_tests",
"//third_party/WebKit/Source/core/mojo:unit_tests",
] ]
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
import("//third_party/WebKit/Source/core/core.gni") import("//third_party/WebKit/Source/core/core.gni")
blink_core_sources("mojo") { blink_core_sources("mojo") {
...@@ -23,3 +24,39 @@ blink_core_sources("mojo") { ...@@ -23,3 +24,39 @@ blink_core_sources("mojo") {
"//services/service_manager/public/cpp", "//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_js_data_deps",
"//mojo/public/js:new_bindings",
]
}
mojom("test_bindings") {
sources = [
"tests/JsToCpp.mojom",
]
}
...@@ -2,26 +2,18 @@ ...@@ -2,26 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
define('mojo/edk/js/tests/js_to_cpp_tests', [ (function () {
'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) {
var retainedJsSide; var retainedJsSide;
var retainedJsSideStub;
var sampleData; var sampleData;
var sampleMessage; var sampleMessage;
var BAD_VALUE = 13; var BAD_VALUE = 13;
var DATA_PIPE_PARAMS = { var DATA_PIPE_PARAMS = {
flags: core.CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,
elementNumBytes: 1, elementNumBytes: 1,
capacityNumBytes: 64 capacityNumBytes: 64
}; };
function JsSideConnection() { function JsSideConnection() {
this.binding = new bindings.Binding(jsToCpp.JsSide, this); this.binding = new mojo.Binding(jsToCpp.JsSide, this);
} }
JsSideConnection.prototype.setCppSide = function(cppSide) { JsSideConnection.prototype.setCppSide = function(cppSide) {
...@@ -55,13 +47,13 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [ ...@@ -55,13 +47,13 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
arg.si8 = BAD_VALUE; arg.si8 = BAD_VALUE;
for (i = 0; i < numIterations; ++i) { for (i = 0; i < numIterations; ++i) {
dataPipe1 = core.createDataPipe(DATA_PIPE_PARAMS); dataPipe1 = Mojo.createDataPipe(DATA_PIPE_PARAMS);
dataPipe2 = core.createDataPipe(DATA_PIPE_PARAMS); dataPipe2 = Mojo.createDataPipe(DATA_PIPE_PARAMS);
messagePipe1 = core.createMessagePipe(); messagePipe1 = Mojo.createMessagePipe();
messagePipe2 = core.createMessagePipe(); messagePipe2 = Mojo.createMessagePipe();
arg.data_handle = dataPipe1.consumerHandle; arg.dataHandle = dataPipe1.consumer;
arg.message_handle = messagePipe1.handle1; arg.messageHandle = messagePipe1.handle1;
specialArg = new jsToCpp.EchoArgs(); specialArg = new jsToCpp.EchoArgs();
specialArg.si64 = -1; specialArg.si64 = -1;
...@@ -69,20 +61,19 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [ ...@@ -69,20 +61,19 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
specialArg.si16 = -1; specialArg.si16 = -1;
specialArg.si8 = -1; specialArg.si8 = -1;
specialArg.name = 'going'; specialArg.name = 'going';
specialArg.data_handle = dataPipe2.consumerHandle; specialArg.dataHandle = dataPipe2.consumer;
specialArg.message_handle = messagePipe2.handle1; specialArg.messageHandle = messagePipe2.handle1;
writeDataPipe(dataPipe1, sampleData); writeDataPipe(dataPipe1, sampleData);
writeDataPipe(dataPipe2, sampleData); writeDataPipe(dataPipe2, sampleData);
writeMessagePipe(messagePipe1, sampleMessage); writeMessagePipe(messagePipe1, sampleMessage);
writeMessagePipe(messagePipe2, sampleMessage); writeMessagePipe(messagePipe2, sampleMessage);
this.cppSide_.echoResponse(createEchoArgsList(specialArg, arg)); this.cppSide_.echoResponse(createEchoArgsList(specialArg, arg));
core.close(dataPipe1.producerHandle); dataPipe1.producer.close();
core.close(dataPipe2.producerHandle); dataPipe2.producer.close();
core.close(messagePipe1.handle0); messagePipe1.handle0.close();
core.close(messagePipe2.handle0); messagePipe2.handle0.close();
} }
this.cppSide_.testFinished(); this.cppSide_.testFinished();
}; };
...@@ -91,7 +82,7 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [ ...@@ -91,7 +82,7 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
var iteration = 0; var iteration = 0;
var dataPipe; var dataPipe;
var messagePipe; var messagePipe;
var proto = connector.Connector.prototype; var proto = mojo.internal.Connector.prototype;
var stopSignalled = false; var stopSignalled = false;
proto.realAccept = proto.accept; proto.realAccept = proto.accept;
...@@ -110,13 +101,13 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [ ...@@ -110,13 +101,13 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
}; };
while (!stopSignalled) { while (!stopSignalled) {
messagePipe = core.createMessagePipe(); messagePipe = Mojo.createMessagePipe();
writeMessagePipe(messagePipe, sampleMessage); writeMessagePipe(messagePipe, sampleMessage);
arg.message_handle = messagePipe.handle1; arg.messageHandle = messagePipe.handle1;
this.cppSide_.bitFlipResponse(createEchoArgsList(arg), null); this.cppSide_.bitFlipResponse(createEchoArgsList(arg), null);
core.close(messagePipe.handle0); messagePipe.handle0.close();
iteration += 1; iteration += 1;
} }
...@@ -129,7 +120,7 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [ ...@@ -129,7 +120,7 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
var iteration = 0; var iteration = 0;
var dataPipe; var dataPipe;
var messagePipe; var messagePipe;
var proto = connector.Connector.prototype; var proto = mojo.internal.Connector.prototype;
var stopSignalled = false; var stopSignalled = false;
proto.realAccept = proto.accept; proto.realAccept = proto.accept;
...@@ -146,13 +137,13 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [ ...@@ -146,13 +137,13 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
}; };
while (!stopSignalled) { while (!stopSignalled) {
messagePipe = core.createMessagePipe(); messagePipe = Mojo.createMessagePipe();
writeMessagePipe(messagePipe, sampleMessage); writeMessagePipe(messagePipe, sampleMessage);
arg.message_handle = messagePipe.handle1; arg.messageHandle = messagePipe.handle1;
this.cppSide_.backPointerResponse(createEchoArgsList(arg)); this.cppSide_.backPointerResponse(createEchoArgsList(arg));
core.close(messagePipe.handle0); messagePipe.handle0.close();
iteration += 1; iteration += 1;
} }
...@@ -162,10 +153,9 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [ ...@@ -162,10 +153,9 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
}; };
function writeDataPipe(pipe, data) { function writeDataPipe(pipe, data) {
var writeResult = core.writeData( var writeResult = pipe.producer.writeData(data);
pipe.producerHandle, data, core.WRITE_DATA_FLAG_ALL_OR_NONE);
if (writeResult.result != core.RESULT_OK) { if (writeResult.result != Mojo.RESULT_OK) {
console.log('ERROR: Data pipe write result was ' + writeResult.result); console.log('ERROR: Data pipe write result was ' + writeResult.result);
return false; return false;
} }
...@@ -177,8 +167,8 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [ ...@@ -177,8 +167,8 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
} }
function writeMessagePipe(pipe, arrayBuffer) { function writeMessagePipe(pipe, arrayBuffer) {
var result = core.writeMessage(pipe.handle0, arrayBuffer, [], 0); var result = pipe.handle0.writeMessage(arrayBuffer, []);
if (result != core.RESULT_OK) { if (result != Mojo.RESULT_OK) {
console.log('ERROR: Message pipe write result was ' + result); console.log('ERROR: Message pipe write result was ' + result);
return false; return false;
} }
...@@ -212,4 +202,4 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [ ...@@ -212,4 +202,4 @@ define('mojo/edk/js/tests/js_to_cpp_tests', [
retainedJsSide = new JsSideConnection; retainedJsSide = new JsSideConnection;
retainedJsSide.binding.bind(jsSideRequestHandle); retainedJsSide.binding.bind(jsSideRequestHandle);
}; };
}); })();
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
...@@ -89,6 +89,12 @@ String BlinkRootDir() { ...@@ -89,6 +89,12 @@ String BlinkRootDir() {
return FilePathToWebString(BlinkRootFilePath()); 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) { String WebTestDataPath(const String& relative_path) {
return FilePathToWebString( return FilePathToWebString(
BlinkRootFilePath() BlinkRootFilePath()
......
...@@ -52,6 +52,9 @@ void YieldCurrentThread(); ...@@ -52,6 +52,9 @@ void YieldCurrentThread();
// /src/third_party/WebKit. // /src/third_party/WebKit.
String BlinkRootDir(); String BlinkRootDir();
// Returns directory containing the current executable as absolute path.
String ExecutableDir();
// Returns test data absolute path for webkit_unit_tests, i.e. // Returns test data absolute path for webkit_unit_tests, i.e.
// <blinkRootDir>/Source/web/tests/data/<relativePath>. // <blinkRootDir>/Source/web/tests/data/<relativePath>.
// It returns the top web test directory if |relativePath| was not specified. // It returns the top web test directory if |relativePath| was not specified.
......
...@@ -119,7 +119,6 @@ ...@@ -119,7 +119,6 @@
'message_center_unittests', 'message_center_unittests',
'midi_unittests', 'midi_unittests',
'mojo_common_unittests', 'mojo_common_unittests',
'mojo_js_integration_tests',
'mojo_js_unittests', 'mojo_js_unittests',
'mojo_public_bindings_unittests', 'mojo_public_bindings_unittests',
'mojo_public_system_unittests', 'mojo_public_system_unittests',
...@@ -276,7 +275,6 @@ ...@@ -276,7 +275,6 @@
'midi_unittests.exe', 'midi_unittests.exe',
'mini_installer.exe', 'mini_installer.exe',
'mksnapshot.exe', 'mksnapshot.exe',
'mojo_js_integration_tests.exe',
'mojo_js_unittests.exe', 'mojo_js_unittests.exe',
'mojo_message_pipe_perftests.exe', 'mojo_message_pipe_perftests.exe',
'mojo_public_bindings_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