-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #689 from dart-lang/merge-browser_launcher-package
Merge `package:browser_launcher`
- Loading branch information
Showing
15 changed files
with
719 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
name: "package:browser_launcher" | ||
about: "Create a bug or file a feature request against package:browser_launcher." | ||
labels: "package:browser_launcher" | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: package:browser_launcher | ||
|
||
on: | ||
# Run on PRs and pushes to the default branch. | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/browser_launcher.yml' | ||
- 'pkgs/browser_launcher/**' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- '.github/workflows/browser_launcher.yml' | ||
- 'pkgs/browser_launcher/**' | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
|
||
env: | ||
PUB_ENVIRONMENT: bot.github | ||
DISPLAY: ':99' | ||
|
||
defaults: | ||
run: | ||
working-directory: pkgs/browser_launcher/ | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
sdk: [3.4, dev] | ||
steps: | ||
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 | ||
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 | ||
with: | ||
sdk: ${{ matrix.sdk }} | ||
|
||
- run: dart pub get | ||
|
||
- run: dart format --output=none --set-exit-if-changed . | ||
- run: dart analyze --fatal-infos | ||
|
||
- name: Run Xvfb | ||
run: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & | ||
|
||
- run: dart test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Don’t commit the following directories created by pub. | ||
.dart_tool/ | ||
.packages | ||
pubspec.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Below is a list of people and organizations that have contributed | ||
# to the project. Names should be added to the list like so: | ||
# | ||
# Name/Organization <email address> | ||
|
||
Google Inc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
## 1.1.3 | ||
|
||
- Move to `dart-lang/tools` monorepo. | ||
|
||
## 1.1.2 | ||
|
||
- Require Dart 3.4 | ||
- Log errors from chrome | ||
- Allow tests to detect headless-only environment (for CI). | ||
- Add extra flags that may help disable additional throttling in background tabs | ||
- Add `--use-mock-keychain` flag to avoid blocking dialog on MacOS. | ||
|
||
## 1.1.1 | ||
|
||
- Populate the pubspec `repository` field. | ||
|
||
## 1.1.0 | ||
|
||
- Add optional `signIn` argument to `startWithDebugPort`. | ||
To be used together with `user-data-dir` to start a Chrome | ||
window signed in to the default profile with extensions enabled. | ||
- Enable the `avoid_dynamic_calls` lint. | ||
|
||
## 1.0.0 | ||
|
||
- Migrate to null-safety. | ||
|
||
## 0.1.10 | ||
|
||
- Support `webkit_inspection_protocol` version `^1.0.0`. | ||
|
||
## 0.1.9 | ||
|
||
- Add support for Chrome executables in `CHROME_PATH`. | ||
|
||
## 0.1.8 | ||
|
||
- Log `STDERR` on Chrome launch failure. | ||
|
||
## 0.1.7 | ||
|
||
- Widen the dependency range on `package:webkit_inspection_protocol`. | ||
|
||
## 0.1.6 | ||
|
||
- Update lower Dart SDK requirement to `2.2.0`. | ||
- Update the dependency range on `package:webkit_inspection_protocol`. | ||
|
||
## 0.1.5 | ||
|
||
- Add a parameter to use a specified user-data-dir instead of a system temp. | ||
|
||
## 0.1.4 | ||
|
||
- Start Chrome maximized. | ||
|
||
## 0.1.3 | ||
|
||
- widen the version constraint on `package:webkit_inspection_protocol` | ||
|
||
## 0.1.2 | ||
|
||
- lower min sdk version to match Flutter stable | ||
|
||
## 0.1.1 | ||
|
||
- added example | ||
|
||
## 0.1.0 | ||
|
||
- initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright 2019, the Dart project authors. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
* Neither the name of Google LLC nor the names of its | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[![Build Status](https://github.com/dart-lang/tools/actions/workflows/browser_launcher.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/browser_launcher.yaml) | ||
[![pub package](https://img.shields.io/pub/v/browser_launcher.svg)](https://pub.dev/packages/browser_launcher) | ||
[![package publisher](https://img.shields.io/pub/publisher/browser_launcher.svg)](https://pub.dev/packages/browser_launcher/publisher) | ||
|
||
Provides a standardized way to launch web browsers. | ||
|
||
Currently, Chrome is the only supported browser; support for other browsers may | ||
be added in the future. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# https://dart.dev/guides/language/analysis-options | ||
include: package:dart_flutter_team_lints/analysis_options.yaml | ||
|
||
analyzer: | ||
language: | ||
strict-casts: true | ||
strict-inference: true | ||
strict-raw-types: true | ||
|
||
linter: | ||
rules: | ||
- avoid_bool_literals_in_conditional_expressions | ||
- avoid_classes_with_only_static_members | ||
- avoid_private_typedef_functions | ||
- avoid_redundant_argument_values | ||
- avoid_returning_this | ||
- avoid_unused_constructor_parameters | ||
- avoid_void_async | ||
- cancel_subscriptions | ||
- join_return_with_assignment | ||
- literal_only_boolean_expressions | ||
- missing_whitespace_between_adjacent_strings | ||
- no_adjacent_strings_in_list | ||
- no_runtimeType_toString | ||
- prefer_const_declarations | ||
- prefer_expression_function_bodies | ||
- prefer_final_locals | ||
- require_trailing_commas | ||
- unnecessary_raw_strings | ||
- use_if_null_to_convert_nulls_to_bools | ||
- use_raw_strings | ||
- use_string_buffers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2024, 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. | ||
|
||
import 'package:browser_launcher/browser_launcher.dart'; | ||
|
||
const _googleUrl = 'https://www.google.com/'; | ||
const _googleImagesUrl = 'https://www.google.com/imghp?hl=en'; | ||
|
||
Future<void> main() async { | ||
// Launches a chrome browser with two tabs open to [_googleUrl] and | ||
// [_googleImagesUrl]. | ||
await Chrome.start([_googleUrl, _googleImagesUrl]); | ||
print('launched Chrome'); | ||
|
||
// Pause briefly before opening Chrome with a debug port. | ||
await Future<void>.delayed(const Duration(seconds: 3)); | ||
|
||
// Launches a chrome browser open to [_googleUrl]. Since we are launching with | ||
// a debug port, we will use a variety of different launch configurations, | ||
// such as launching in a new browser. | ||
final chrome = await Chrome.startWithDebugPort([_googleUrl], debugPort: 8888); | ||
print('launched Chrome with a debug port'); | ||
|
||
// When running this dart code, observe that the browser stays open for 3 | ||
// seconds before we close it. | ||
await Future<void>.delayed(const Duration(seconds: 3)); | ||
|
||
await chrome.close(); | ||
print('closed Chrome'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) 2019, 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. | ||
|
||
export 'src/chrome.dart'; |
Oops, something went wrong.