diff --git a/.codespellignorelines b/.codespellignorelines index 0c7fa5f28f2c8..715a87ea780a2 100644 --- a/.codespellignorelines +++ b/.codespellignorelines @@ -8,3 +8,4 @@ GrMipMapped::kNo, texture_info)); Onces represent initializations that should only ever happen once per process, + diff --git a/.github/workflows/evergreen.yaml b/.github/workflows/evergreen.yaml index e33aba97c124a..61ab2ce7df960 100644 --- a/.github/workflows/evergreen.yaml +++ b/.github/workflows/evergreen.yaml @@ -11,7 +11,7 @@ on: - main - feature/* schedule: - - cron: '0 4 * * *' + - cron: '0 6 * * *' workflow_dispatch: inputs: nightly: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2373253224962..c68a98a021bfc 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -13,7 +13,7 @@ on: - feature/* concurrency: - group: '${{ github.workflow }}-${{ inputs.platform }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.sha }}' + group: '${{ github.workflow }}-${{ github.event_name }}-${{ inputs.platform }} @ ${{ github.event.pull_request.head.repo.id}}:${{ github.event.pull_request.head.label || github.head_ref || github.sha }}' cancel-in-progress: true permissions: {} diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 02cc3e3ea4f0e..4fc49a1f01829 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -32,7 +32,7 @@ env: STARBOARD_TOOLCHAINS_DIR: /root/starboard-toolchains concurrency: - group: '${{ github.workflow }}-${{ inputs.platform }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.sha }}' + group: '${{ github.workflow }}-${{ github.event_name }}-${{ github.event.action }}-${{ inputs.platform }} @ ${{ github.event.pull_request.number || github.sha }}' cancel-in-progress: true # A workflow run is made up of one or more jobs that can run sequentially or in parallel @@ -50,10 +50,12 @@ jobs: if: | github.event_name != 'pull_request' || ( - github.event.pull_request.draft == false || + ( github.event.pull_request.draft == false && + github.event.action != 'labeled' ) || ( github.event.action == 'labeled' && - github.event.label.name == 'runtest' + ( github.event.label.name == 'runtest' || + github.event.label.name == 'on_device' ) ) ) steps: diff --git a/.github/workflows/main_win.yaml b/.github/workflows/main_win.yaml index 60b0554c85a9e..49677073caec1 100644 --- a/.github/workflows/main_win.yaml +++ b/.github/workflows/main_win.yaml @@ -33,7 +33,7 @@ env: STARBOARD_TOOLCHAINS_DIR: /root/starboard-toolchains concurrency: - group: '${{ github.workflow }}-${{ inputs.platform }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.sha }}' + group: '${{ github.workflow }}-${{ github.event_name }}-${{ inputs.platform }} @ ${{ github.event.pull_request.head.repo.id}}:${{ github.event.pull_request.head.label || github.head_ref || github.sha }}' cancel-in-progress: true # A workflow run is made up of one or more jobs that can run sequentially or in parallel @@ -51,11 +51,10 @@ jobs: if: | github.event_name != 'pull_request' || ( - github.event.pull_request.draft == false || - ( - github.event.action == 'labeled' && - github.event.label.name == 'runtest' - ) + ( github.event.pull_request.draft == false && + github.event.action != 'labeled' ) || + ( github.event.action == 'labeled' && + github.event.label.name == 'runtest' ) ) steps: - id: Checkout diff --git a/.github/workflows/pr_badges.yaml b/.github/workflows/pr_badges.yaml index d83d9a8ed4430..36613194c7bf8 100644 --- a/.github/workflows/pr_badges.yaml +++ b/.github/workflows/pr_badges.yaml @@ -14,9 +14,10 @@ on: - 'COBALT_9' concurrency: - group: '${{ github.workflow }}-${{ inputs.platform }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.sha }}' + group: '${{ github.workflow }}-${{ github.event_name }}-${{ inputs.platform }} @ ${{ github.event.pull_request.head.repo.id}}:${{ github.event.pull_request.head.label || github.head_ref || github.sha }}' cancel-in-progress: true + permissions: pull-requests: write diff --git a/.github/workflows/raspi-2.yaml b/.github/workflows/raspi-2.yaml index 74756bac06a2e..79ebcee9366a6 100644 --- a/.github/workflows/raspi-2.yaml +++ b/.github/workflows/raspi-2.yaml @@ -11,7 +11,7 @@ on: - main - feature/* schedule: - - cron: '0 4 * * *' + - cron: '0 7 * * *' workflow_dispatch: inputs: nightly: @@ -29,11 +29,11 @@ jobs: with: platform: raspi-2 nightly: ${{ github.event.inputs.nightly }} - raspi-2-skia: - uses: ./.github/workflows/main.yaml - permissions: - packages: write - pull-requests: write - with: - platform: raspi-2-skia - nightly: ${{ github.event.inputs.nightly }} + # raspi-2-skia: + # uses: ./.github/workflows/main.yaml + # permissions: + # packages: write + # pull-requests: write + # with: + # platform: raspi-2-skia + # nightly: ${{ github.event.inputs.nightly }} diff --git a/.github/workflows/test-report.yaml b/.github/workflows/test-report.yaml new file mode 100644 index 0000000000000..c8dfe8bec925c --- /dev/null +++ b/.github/workflows/test-report.yaml @@ -0,0 +1,26 @@ +name: 'Test Report' +on: + workflow_run: + # runs after main workflow + workflows: + - evergreen + - linux + # TODO + # - win32 + types: + - completed +jobs: + report: + runs-on: ubuntu-latest + steps: + - name: Download test results + uses: actions/download-artifact@v3 + with: + name: unit-test-report + path: ${GITHUB_WORKSPACE}/test_results + - name: Create Report + uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 + with: + name: Cobalt Unit Tests + path: ${GITHUB_WORKSPACE}/test_results/**/*.xml + reporter: jest-junit diff --git a/.github/workflows/workflow_trigger.yaml b/.github/workflows/workflow_trigger.yaml new file mode 100644 index 0000000000000..ac9b93305c6b7 --- /dev/null +++ b/.github/workflows/workflow_trigger.yaml @@ -0,0 +1,48 @@ +name: workflow_trigger + +on: + workflow_dispatch: + inputs: + branch: + type: choice + description: Branch + options: + - '23.lts.1+' + - '22.lts.1+' + - '21.lts.1+' + - '20.lts.1+' + - '19.lts.1+' + - 'rc_11' + - 'COBALT_9' + workflow: + type: choice + description: Workflow name + options: + - 'android' + - 'evergreen' + - 'linux' + - 'raspi' + - 'win32' + nightly: + description: 'Nightly workflow.' + required: true + type: boolean + default: false + +jobs: + trigger: + permissions: + actions: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 1 + ref: ${{github.event.branch}} + - name: Trigger Nightly + run: | + set -x + gh workflow run ${{github.event.inputs.workflow}}_${{github.event.inputs.branch}} --ref ${{github.event.inputs.branch}} -f nightly=${{github.event.inputs.nightly}} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 9a5a5caa9c013..28ba8eb52921e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /venv/* _certs/ .coverage + diff --git a/BUILD.gn b/BUILD.gn index d2d4ccd63b57f..1363623328751 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + group("gn_all") { testonly = true diff --git a/README.md b/README.md index 8f2fff9c03432..1410af546b8f7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Cobalt [![Build Status](https://img.shields.io/badge/-Build%20Status-blueviolet)](https://github.com/youtube/cobalt/blob/main/BUILD_STATUS.md) -Test change - ## Overview Cobalt is a lightweight application container (i.e. an application runtime, like @@ -73,6 +71,8 @@ Chromium, FireFox, and IE: ## Architecture +One more test + The Cobalt Authors forked H5VCC, removed most of the Chromium code -- in particular WebCore and the Chrome Renderer and Compositor -- and built up from scratch an implementation of a simplified subset of HTML, the CSS Box Model for diff --git a/cobalt/webdriver/algorithms.cc b/cobalt/webdriver/algorithms.cc index e4c6a5b662496..155e60535f281 100644 --- a/cobalt/webdriver/algorithms.cc +++ b/cobalt/webdriver/algorithms.cc @@ -455,7 +455,7 @@ std::string GetElementText(dom::Element* element) { } // There is a spec for "displayedness" available: -// https://w3c.github.io/webdriver/webdriver-spec.html#element-displayedness +// https://www.w3.org/TR/2015/WD-webdriver-20150808/#element-displayedness // However, the algorithm described in the spec does not match existing // implementations of WebDriver. // IsDisplayed will match the existing implementations, using the implementation diff --git a/cobalt/webdriver/algorithms.h b/cobalt/webdriver/algorithms.h index d75d3b2be157c..df7f2ccb296a2 100644 --- a/cobalt/webdriver/algorithms.h +++ b/cobalt/webdriver/algorithms.h @@ -24,13 +24,13 @@ namespace webdriver { namespace algorithms { // Implementation of getElementText algorithm. -// https://w3c.github.io/webdriver/webdriver-spec.html#getelementtext +// https://www.w3.org/TR/2015/WD-webdriver-20150808/#getelementtext // The spec is not totally clear and, according to comments on the spec, does // not exactly match the behavior of existing WebDriver implementations. This // implementation will follow the de-facto standards where they differ. std::string GetElementText(dom::Element* element); -// https://w3c.github.io/webdriver/webdriver-spec.html#element-displayedness +// https://www.w3.org/TR/2015/WD-webdriver-20150808/#element-displayedness // The spec does not exactly match the behavior of existing WebDriver // implementations. Consistency with existing implementations will be preferred // over strict conformance to the draft spec. diff --git a/cobalt/webdriver/dispatcher.h b/cobalt/webdriver/dispatcher.h index 56796babe9428..ae29bb1348592 100644 --- a/cobalt/webdriver/dispatcher.h +++ b/cobalt/webdriver/dispatcher.h @@ -76,8 +76,8 @@ class WebDriverDispatcher { }; // Send the result of the execution of a registered WebDriver command to be // sent as a response as described in the spec: - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#Responses - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#Failed-Commands + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#responses + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#failed-commands virtual void SendResult( const base::Optional& session_id, protocol::Response::StatusCode status_code, @@ -95,7 +95,7 @@ class WebDriverDispatcher { // Some forms of Invalid Requests are detected in the CommandCallback by // checking the path variables and command parameters. Invalid requests are // described here: - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#Invalid-Requests + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#invalid-requests // // TODO: Invalid requests should be handled before calling the // CommandCallback. diff --git a/cobalt/webdriver/element_driver.cc b/cobalt/webdriver/element_driver.cc index 0f36d4bee435e..9fbd3113cf7bf 100644 --- a/cobalt/webdriver/element_driver.cc +++ b/cobalt/webdriver/element_driver.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "cobalt/webdriver/element_driver.h" +#include + #include "cobalt/cssom/property_value.h" #include "cobalt/cssom/viewport_size.h" #include "cobalt/dom/document.h" @@ -266,14 +266,14 @@ util::CommandResult ElementDriver::SendClickInternal( return CommandResult(protocol::Response::kElementNotVisible); } // Click on an element. - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidclick + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidelementidclick // The Element Click clicks the in-view center point of the element - // https://w3c.github.io/webdriver/webdriver-spec.html#dfn-element-click + // https://www.w3.org/TR/2015/WD-webdriver-20150808/#click // An element's in-view center point is the origin position of the rectangle // that is the intersection between the element's first DOM client rectangle // and the initial viewport. - // https://w3c.github.io/webdriver/webdriver-spec.html#dfn-in-view-center-point + // https://www.w3.org/TR/2017/WD-webdriver-20170125/#dfn-in-view-center-point scoped_refptr dom_rects = element_->GetClientRects(); if (dom_rects->length() == 0) { return CommandResult(protocol::Response::kElementNotVisible); diff --git a/cobalt/webdriver/element_driver.h b/cobalt/webdriver/element_driver.h index 5a29e5dbad27e..471f129369ea9 100644 --- a/cobalt/webdriver/element_driver.h +++ b/cobalt/webdriver/element_driver.h @@ -46,7 +46,7 @@ class WindowDriver; // ElementDriver could be considered a WebElement as described in the WebDriver // spec. -// https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#webelement +// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#webelement // Commands that interact with a WebElement, such as: // /session/:sessionId/element/:id/some_command // will map to a method on this class. diff --git a/cobalt/webdriver/protocol/button.h b/cobalt/webdriver/protocol/button.h index 9866ea5cf6710..50db38010cba6 100644 --- a/cobalt/webdriver/protocol/button.h +++ b/cobalt/webdriver/protocol/button.h @@ -27,9 +27,9 @@ namespace protocol { // Represents the JSON parameters passed to the click, buttondown, and buttonup // WebDriver commands. -// https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidclick -// https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidbuttondown -// https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidbuttonup +// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidelementidclick +// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidbuttondown +// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidbuttonup class Button { public: static std::unique_ptr ToValue(const Button& button); diff --git a/cobalt/webdriver/protocol/capabilities.h b/cobalt/webdriver/protocol/capabilities.h index 54ca1b08c294a..87893de1dfc2a 100644 --- a/cobalt/webdriver/protocol/capabilities.h +++ b/cobalt/webdriver/protocol/capabilities.h @@ -45,7 +45,7 @@ class Capabilities { private: Capabilities() {} // The capabilities listed here: - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#Capabilities-JSON-Object + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#capabilities-json-object base::Optional browser_name_; base::Optional version_; diff --git a/cobalt/webdriver/protocol/cookie.h b/cobalt/webdriver/protocol/cookie.h index 4d1357d888a33..70f69cbe48544 100644 --- a/cobalt/webdriver/protocol/cookie.h +++ b/cobalt/webdriver/protocol/cookie.h @@ -27,7 +27,7 @@ namespace cobalt { namespace webdriver { namespace protocol { -// https://w3c.github.io/webdriver/webdriver-spec.html#cookies +// https://www.w3.org/TR/2015/WD-webdriver-20150808/#cookies class Cookie { public: static std::unique_ptr ToValue(const Cookie& cookie); diff --git a/cobalt/webdriver/protocol/element_id.h b/cobalt/webdriver/protocol/element_id.h index 94b75c383c968..ec322a64c3614 100644 --- a/cobalt/webdriver/protocol/element_id.h +++ b/cobalt/webdriver/protocol/element_id.h @@ -31,7 +31,7 @@ class ElementId { static const char kElementKey[]; // Convert the ElementId to a WebElement JSON object: - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#WebElement-JSON-Object + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#webelement-json-object static std::unique_ptr ToValue(const ElementId& element_id); static base::Optional FromValue(const base::Value* value); diff --git a/cobalt/webdriver/protocol/frame_id.h b/cobalt/webdriver/protocol/frame_id.h index 4e2e7ce1ed33c..3cdaeb7540e23 100644 --- a/cobalt/webdriver/protocol/frame_id.h +++ b/cobalt/webdriver/protocol/frame_id.h @@ -22,7 +22,7 @@ namespace cobalt { namespace webdriver { namespace protocol { -// https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidframe +// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidframe // Since Cobalt doesn't support multiple frames, the only valid value for this // command is to request switching to the top-level browsing context, which // is always active. diff --git a/cobalt/webdriver/protocol/log_entry.cc b/cobalt/webdriver/protocol/log_entry.cc index 297c0847adefe..d0682c1125fd6 100644 --- a/cobalt/webdriver/protocol/log_entry.cc +++ b/cobalt/webdriver/protocol/log_entry.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "cobalt/webdriver/protocol/log_entry.h" +#include + #include "base/logging.h" namespace cobalt { @@ -48,7 +48,7 @@ std::unique_ptr LogEntry::ToValue(const LogEntry& log_entry) { std::unique_ptr log_entry_value( new base::DictionaryValue()); // Format of the Log Entry object can be found here: - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#Log-Entry-JSON-Object + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#log-entry-json-object // timestamp is in milliseconds since the Unix Epoch. log_entry_value->SetInteger("timestamp", log_entry.timestamp_.InMilliseconds()); diff --git a/cobalt/webdriver/protocol/log_entry.h b/cobalt/webdriver/protocol/log_entry.h index 94d01bdd2d83a..777b66f8b96e3 100644 --- a/cobalt/webdriver/protocol/log_entry.h +++ b/cobalt/webdriver/protocol/log_entry.h @@ -26,7 +26,7 @@ namespace webdriver { namespace protocol { // Log entry object: -// https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#Log-Entry-JSON-Object +// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#log-entry-json-object class LogEntry { public: enum LogLevel { diff --git a/cobalt/webdriver/protocol/moveto.h b/cobalt/webdriver/protocol/moveto.h index c1be6dcb39425..0819a1fab8a0f 100644 --- a/cobalt/webdriver/protocol/moveto.h +++ b/cobalt/webdriver/protocol/moveto.h @@ -26,7 +26,7 @@ namespace webdriver { namespace protocol { // Represents the JSON parameters passed to the moveto WebDriver command. -// https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidmoveto +// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidmoveto class Moveto { public: static std::unique_ptr ToValue(const Moveto& moveto); diff --git a/cobalt/webdriver/protocol/response.h b/cobalt/webdriver/protocol/response.h index 0244c1453d4ff..1995ed2ca4882 100644 --- a/cobalt/webdriver/protocol/response.h +++ b/cobalt/webdriver/protocol/response.h @@ -29,7 +29,7 @@ namespace protocol { class Response { public: // WebDriver Response Status Codes: - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#Response-Status-Codes + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#response-status-codes enum StatusCode { // The command executed successfully. kSuccess = 0, @@ -79,13 +79,13 @@ class Response { // Create a JSON object that will be used as the response body for a failed // command: - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#Failed-Commands + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#failed-commands // TODO: Add support for screenshot, stack trace, etc. static std::unique_ptr CreateErrorResponse( const std::string& message); // Create a JSON object that will be used as the response body for a command: - // https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#Responses + // https://www.selenium.dev/documentation/legacy/json_wire_protocol/#responses static std::unique_ptr CreateResponse( const base::Optional& session_id, StatusCode status_code, diff --git a/cobalt/webdriver/protocol/script.h b/cobalt/webdriver/protocol/script.h index 78256fc31adce..e1ad598b6b3d9 100644 --- a/cobalt/webdriver/protocol/script.h +++ b/cobalt/webdriver/protocol/script.h @@ -27,8 +27,8 @@ namespace protocol { // Represents the JSON parameters passed to the execute and execute_async // WebDriver commands. -// https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidexecute -// https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidexecute-async +// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidexecute +// https://www.selenium.dev/documentation/legacy/json_wire_protocol/#sessionsessionidexecute_async class Script { public: static base::Optional