[dart:html] Copy test resources from lib_2 to lib

Some none Dart files were not copied over in the migration. Tests
are refactored to use the lib version over lib_2.

Change-Id: I21053d81770c4f83b01f27af99cec11f08577c7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143330
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This commit is contained in:
Srujan Gaddam 2020-04-13 23:56:08 +00:00 committed by commit-bot@chromium.org
parent b65704e817
commit 09e47b6177
19 changed files with 59 additions and 15 deletions

BIN
tests/lib/html/Ahem.ttf Normal file

Binary file not shown.

View file

@ -20,8 +20,8 @@ import 'package:async_helper/async_helper.dart';
// avconv -i small.mp4 small.webm
// python -m base64 -e small.mp4
// python -m base64 -e small.webm
var mp4VideoUrl = '/root_dart/tests/lib_2/html/small.mp4';
var webmVideoUrl = '/root_dart/tests/lib_2/html/small.webm';
var mp4VideoUrl = '/root_dart/tests/lib/html/small.mp4';
var webmVideoUrl = '/root_dart/tests/lib/html/small.webm';
var mp4VideoDataUrl =
'data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAA'
'AIZnJlZQAAAsdtZGF0AAACmwYF//+X3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlID'

View file

@ -8,7 +8,7 @@
<body>
<script type="application/javascript"
src="/root_dart/tests/lib_2/html/cross_domain_iframe_script.js">
src="/root_dart/tests/lib/html/cross_domain_iframe_script.js">
</script>
</body>
</html>

View file

@ -0,0 +1 @@
window.parent.postMessage('foobar', '*');

View file

@ -11,7 +11,7 @@ main() {
var crossOriginPort = int.parse(uri.queryParameters['crossOriginPort']!);
var crossOrigin = '${uri.scheme}://${uri.host}:$crossOriginPort';
var crossOriginUrl =
'$crossOrigin/root_dart/tests/lib_2/html/cross_domain_iframe_script.html';
'$crossOrigin/root_dart/tests/lib/html/cross_domain_iframe_script.html';
var iframe = new IFrameElement();
iframe.src = crossOriginUrl;

View file

@ -0,0 +1,5 @@
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
//
window.parent.dispatchEvent(new Event('detect_errors'));

View file

@ -19,7 +19,7 @@ main() {
<style>
@font-face {
font-family: 'Ahem';
src: url(/root_dart/tests/lib_2/html/Ahem.ttf);
src: url(/root_dart/tests/lib/html/Ahem.ttf);
font-style: italic;
font-weight: 300;
unicode-range: U+0-3FF;

View file

@ -19,7 +19,7 @@
<body>
<h1> Running js_type_test </h1>
<script type="text/javascript"
src="/root_dart/tests/lib_2/html/js_dispatch_property_test_js.js"></script>
src="/root_dart/tests/lib/html/js_dispatch_property_test_js.js"></script>
<script type="text/javascript"
src="/root_dart/pkg/test_runner/lib/src/test_controller.js"></script>
%TEST_SCRIPTS%

View file

@ -0,0 +1,17 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
self.create = function() {
return {
// If the dispatch property name is uninitialized, it will be `undefined` or
// `null`, which will match these properties on dispatch record
// lookup. These properties map to malformed dispatch records to force an
// error.
'undefined': {p: false},
'null': {p: false},
foo: function(x) { return 'Foo ' + x; },
};
}

View file

@ -14,7 +14,7 @@
<body>
<h1> Running div_test </h1>
<script type="text/javascript"
src="/root_dart/tests/lib_2/html/js_interop_constructor_name/test_js.js"></script>
src="/root_dart/tests/lib/html/js_interop_constructor_name/test_js.js"></script>
<script type="text/javascript"
src="/root_dart/pkg/test_runner/lib/src/test_controller.js"></script>
%TEST_SCRIPTS%

View file

@ -14,7 +14,7 @@
<body>
<h1> Running error1_test </h1>
<script type="text/javascript"
src="/root_dart/tests/lib_2/html/js_interop_constructor_name/test_js.js"></script>
src="/root_dart/tests/lib/html/js_interop_constructor_name/test_js.js"></script>
<script type="text/javascript"
src="/root_dart/pkg/test_runner/lib/src/test_controller.js"></script>
%TEST_SCRIPTS%

View file

@ -14,7 +14,7 @@
<body>
<h1> Running error2_test </h1>
<script type="text/javascript"
src="/root_dart/tests/lib_2/html/js_interop_constructor_name/test_js.js"></script>
src="/root_dart/tests/lib/html/js_interop_constructor_name/test_js.js"></script>
<script type="text/javascript"
src="/root_dart/pkg/test_runner/lib/src/test_controller.js"></script>
%TEST_SCRIPTS%

View file

@ -14,7 +14,7 @@
<body>
<h1> Running method_test </h1>
<script type="text/javascript"
src="/root_dart/tests/lib_2/html/js_interop_constructor_name/test_js.js"></script>
src="/root_dart/tests/lib/html/js_interop_constructor_name/test_js.js"></script>
<script type="text/javascript"
src="/root_dart/pkg/test_runner/lib/src/test_controller.js"></script>
%TEST_SCRIPTS%

View file

@ -0,0 +1,20 @@
(function() {
// A constructor function with the same name as a HTML element.
function HTMLDivElement(a) {
this.a = a;
}
HTMLDivElement.prototype.bar = function() {
return this.a;
}
HTMLDivElement.prototype.toString = function() {
return "HTMLDivElement(" + this.a + ")";
}
self.makeDiv = function(text) {
return new HTMLDivElement(text);
};
})();

BIN
tests/lib/html/small.mp4 Normal file

Binary file not shown.

BIN
tests/lib/html/small.webm Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

View file

@ -30,7 +30,7 @@ var host = '${window.location.protocol}//${window.location.hostname}:$port';
Future testGetCrossDomain() async {
var gotError = false;
var url = '$host/root_dart/tests/lib_2/html/xhr_cross_origin_data.txt';
var url = '$host/root_dart/tests/lib/html/xhr_cross_origin_data.txt';
try {
var xhr = await HttpRequest.request(url);
var data = json.decode(xhr.response);
@ -46,7 +46,7 @@ Future testGetCrossDomain() async {
}
Future testRequestCrossOrigin() async {
var url = '$host/root_dart/tests/lib_2/html/xhr_cross_origin_data.txt';
var url = '$host/root_dart/tests/lib/html/xhr_cross_origin_data.txt';
var response = await HttpRequest.requestCrossOrigin(url);
expect(response.contains('feed'), isTrue);
}
@ -61,7 +61,7 @@ Future testRequestCrossOriginErrors() async {
}
void testCrossDomain() {
var url = '$host/root_dart/tests/lib_2/html/xhr_cross_origin_data.txt';
var url = '$host/root_dart/tests/lib/html/xhr_cross_origin_data.txt';
var xhr = new HttpRequest();
xhr.open('GET', url, async: true);
var validate = expectAsync((data) {
@ -78,7 +78,7 @@ void testCrossDomain() {
}
Future testGetWithCredentialsCrossDomain() async {
var url = '$host/root_dart/tests/lib_2/html/xhr_cross_origin_data.txt';
var url = '$host/root_dart/tests/lib/html/xhr_cross_origin_data.txt';
var xhr = await HttpRequest.request(url, withCredentials: true);
var data = json.decode(xhr.response);
expect(data.containsKey('feed'), isTrue);

View file

@ -15,7 +15,7 @@ import 'package:async_helper/async_helper.dart';
// Cache blocker is a workaround for:
// https://code.google.com/p/dart/issues/detail?id=11834
var cacheBlocker = new DateTime.now().millisecondsSinceEpoch;
var url = '/root_dart/tests/lib_2/html/xhr_cross_origin_data.txt?'
var url = '/root_dart/tests/lib/html/xhr_cross_origin_data.txt?'
'cacheBlock=$cacheBlocker';
void validate200Response(xhr) {