Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c18c8bd
change from build_runner to dart2js
Aug 9, 2020
4d3d80b
add internalBootstrapBrowserTest to some of the tests
Aug 9, 2020
96630cb
add internalBootstrapBrowserTest to all remaining tests
Aug 9, 2020
01d0bb0
make tests build in paralel. Total time dropped from 586 to 177 secon…
Aug 10, 2020
4136fd8
change isolates with pool
Aug 12, 2020
96e4a04
fixing analysis errors
Aug 12, 2020
7da0438
skipping canvaskit tests for ios-safari
Aug 12, 2020
4fad778
copy image files to the build directory
Aug 13, 2020
b494c44
adding internalBootstrapBrowserTest to newly added tests
Aug 13, 2020
96f7adb
add internalBootstrapBrowserTest to faling path iterator test
Aug 13, 2020
6cba9c0
necessary changes to make chrome windows work
Aug 13, 2020
eb3a263
in windows test in chrome instead of edge. our edge code was for lega…
Aug 13, 2020
8dc6f2c
do not run golden unit tests on Windows LUCI bots for now
Aug 13, 2020
140f1d7
addressing reviewer comments. Adding a method for deciding when to ru…
Aug 15, 2020
b070e8c
remove lines that I forgot to remove
Aug 15, 2020
c4772d1
fixing analysis error. add issue for todo
Aug 15, 2020
d18f418
add bootstap to a test file
Aug 15, 2020
1bcf1f0
adding bootstrap to another test
Aug 15, 2020
04e8d7c
add internalBootstrapBrowserTest to a golden test
Aug 15, 2020
1af5a23
return test result in bat file. use archieve package to unzip
Aug 17, 2020
349a1a9
fixing logs for chrome_installer
Aug 17, 2020
9434a41
use archieve and archieve entity instead of dynamic
Aug 17, 2020
eddb2e7
adding comments for windows platform archieve part
Aug 17, 2020
dd1236d
addressing reviewer comments
Aug 17, 2020
0553059
change readme file
Aug 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/web_ui/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ felt build [-w] -j 100

If you are a Google employee, you can use an internal instance of Goma to parallelize your builds. Because Goma compiles code on remote servers, this option is effective even on low-powered laptops.

By default, when compiling Dart code to JavaScript, we use 4 `dart2js` workers.
If you need to increase or reduce the number of workers, set the `BUILD_MAX_WORKERS_PER_TASK`
environment variable to the desired number.
By default, when compiling Dart code to JavaScript, we use 8 `dart2js` workers.

## Running web engine tests

Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/dev/browser_lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ chrome:
# is not working with chrome.binary option.
Linux: 741412
Mac: 735194
Win: 735105
Win: 768975
firefox:
version: '72.0'
edge:
Expand Down
62 changes: 50 additions & 12 deletions lib/web_ui/dev/chrome_installer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
// found in the LICENSE file.

// @dart = 2.6
import 'dart:async';
import 'dart:io' as io;

import 'package:archive/archive.dart';
import 'package:archive/archive_io.dart';
import 'package:args/args.dart';
import 'package:http/http.dart';
import 'package:meta/meta.dart';
Expand Down Expand Up @@ -186,7 +189,7 @@ class ChromeInstaller {
} else if (versionDir.existsSync() && isLuci) {
print('INFO: Chrome version directory in LUCI: '
'${versionDir.path}');
} else if(!versionDir.existsSync() && isLuci) {
} else if (!versionDir.existsSync() && isLuci) {
// Chrome should have been deployed as a CIPD package on LUCI.
// Throw if it does not exists.
throw StateError('Failed to locate Chrome on LUCI on path:'
Expand All @@ -196,6 +199,8 @@ class ChromeInstaller {
versionDir.createSync(recursive: true);
}

print('INFO: Starting Chrome download.');

final String url = PlatformBinding.instance.getChromeDownloadUrl(version);
final StreamedResponse download = await client.send(Request(
'GET',
Expand All @@ -206,17 +211,50 @@ class ChromeInstaller {
io.File(path.join(versionDir.path, 'chrome.zip'));
await download.stream.pipe(downloadedFile.openWrite());

final io.ProcessResult unzipResult = await io.Process.run('unzip', <String>[
downloadedFile.path,
'-d',
versionDir.path,
]);

if (unzipResult.exitCode != 0) {
throw BrowserInstallerException(
'Failed to unzip the downloaded Chrome archive ${downloadedFile.path}.\n'
'With the version path ${versionDir.path}\n'
'The unzip process exited with code ${unzipResult.exitCode}.');
/// Windows LUCI bots does not have a `unzip`. Instead we are
/// using `archive` pub package.
///
/// We didn't use `archieve` on Mac/Linux since the new files have
/// permission issues. For now we are not able change file permissions
/// from dart.
/// See: https://github.com/dart-lang/sdk/issues/15078.
if (io.Platform.isWindows) {
final Stopwatch stopwatch = Stopwatch()..start();

// Read the Zip file from disk.
final bytes = downloadedFile.readAsBytesSync();

final Archive archive = ZipDecoder().decodeBytes(bytes);

// Extract the contents of the Zip archive to disk.
for (final ArchiveFile file in archive) {
final String filename = file.name;
if (file.isFile) {
final data = file.content as List<int>;
io.File(path.join(versionDir.path, filename))
..createSync(recursive: true)
..writeAsBytesSync(data);
} else {
io.Directory(path.join(versionDir.path, filename))
..create(recursive: true);
}
}

stopwatch.stop();
print('INFO: The unzip took ${stopwatch.elapsedMilliseconds ~/ 1000} seconds.');
} else {
final io.ProcessResult unzipResult =
await io.Process.run('unzip', <String>[
downloadedFile.path,
'-d',
versionDir.path,
]);
if (unzipResult.exitCode != 0) {
throw BrowserInstallerException(
'Failed to unzip the downloaded Chrome archive ${downloadedFile.path}.\n'
'With the version path ${versionDir.path}\n'
'The unzip process exited with code ${unzipResult.exitCode}.');
}
}

downloadedFile.deleteSync();
Expand Down
4 changes: 2 additions & 2 deletions lib/web_ui/dev/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ class _WindowsBinding implements PlatformBinding {

@override
String getChromeDownloadUrl(String version) =>
'https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Win%2F${version}%2Fchrome-win32.zip?alt=media';
'https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Win%2F${version}%2Fchrome-win.zip?alt=media';

@override
String getChromeExecutablePath(io.Directory versionDir) =>
path.join(versionDir.path, 'chrome-win32', 'chrome');
path.join(versionDir.path, 'chrome-win', 'chrome.exe');

@override
String getFirefoxDownloadUrl(String version) =>
Expand Down
6 changes: 3 additions & 3 deletions lib/web_ui/dev/felt_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ IF %orTempValue%==0 (
:: TODO(nurhan): The batch script does not support snanphot option.
:: Support snapshot option.
CALL :installdeps
IF %1==test (%DART_SDK_DIR%\bin\dart "%DEV_DIR%\felt.dart" %* --browser=edge) ELSE ( %DART_SDK_DIR%\bin\dart "%DEV_DIR%\felt.dart" %* )
IF %1==test (%DART_SDK_DIR%\bin\dart "%DEV_DIR%\felt.dart" %* --browser=chrome) ELSE ( %DART_SDK_DIR%\bin\dart "%DEV_DIR%\felt.dart" %* )

EXIT /B 0
EXIT /B %ERRORLEVEL%

:installdeps
ECHO "Running \`pub get\` in 'engine/src/flutter/web_sdk/web_engine_tester'"
cd "%FLUTTER_DIR%web_sdk\web_engine_tester"
CALL %PUB_DIR% get
ECHO "Running \`pub get\` in 'engine/src/flutter/lib/web_ui'"
cd %WEB_UI_DIR%
cd %WEB_UI_DIR%
CALL %PUB_DIR% get
EXIT /B 0
31 changes: 12 additions & 19 deletions lib/web_ui/dev/test_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import 'package:test_core/src/runner/environment.dart'; // ignore: implementatio

import 'package:test_core/src/util/io.dart'; // ignore: implementation_imports
import 'package:test_core/src/runner/configuration.dart'; // ignore: implementation_imports
import 'package:test_core/src/runner/load_exception.dart'; // ignore: implementation_imports
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'
as wip;

Expand Down Expand Up @@ -407,15 +406,6 @@ Golden file $filename did not match the image generated by the test.
throw ArgumentError('$browser is not a browser.');
}

var htmlPath = p.withoutExtension(path) + '.html';
if (File(htmlPath).existsSync() &&
!File(htmlPath).readAsStringSync().contains('packages/test/dart.js')) {
throw LoadException(
path,
'"${htmlPath}" must contain <script src="packages/test/dart.js">'
'</script>.');
}

if (_closed) {
return null;
}
Expand Down Expand Up @@ -811,15 +801,18 @@ class BrowserManager {
controller = deserializeSuite(path, currentPlatform(_runtime),
suiteConfig, await _environment, suiteChannel, message);

final String mapPath = p.join(
env.environment.webUiRootDir.path,
'build',
'$path.browser_test.dart.js.map',
);
PackageConfig packageConfig = await loadPackageConfigUri(
await Isolate.packageConfig);
Map<String, Uri> packageMap =
{for (var p in packageConfig.packages) p.name: p.packageUriRoot};
final String sourceMapFileName =
'${p.basename(path)}.browser_test.dart.js.map';
final String pathToTest = p.dirname(path);

final String mapPath = p.join(env.environment.webUiRootDir.path,
'build', pathToTest, sourceMapFileName);

PackageConfig packageConfig =
await loadPackageConfigUri(await Isolate.packageConfig);
Map<String, Uri> packageMap = {
for (var p in packageConfig.packages) p.name: p.packageUriRoot
};
final JSStackTraceMapper mapper = JSStackTraceMapper(
await File(mapPath).readAsString(),
mapUrl: p.toUri(mapPath),
Expand Down
Loading