Skip to content

Commit

Permalink
Merge main into Ozone (#4659)
Browse files Browse the repository at this point in the history
Keep Ozone up to date 

Tested on Cloudtop,

---------

Co-authored-by: Hao <[email protected]>
Co-authored-by: Andrew Savage <[email protected]>
Co-authored-by: Dana Dahlstrom <[email protected]>
Co-authored-by: Holden Warriner <[email protected]>
Co-authored-by: xiaomings <[email protected]>
Co-authored-by: Brian Ting <[email protected]>
Co-authored-by: Oscar Vestlie <[email protected]>
Co-authored-by: Bo-Rong Chen <[email protected]>
Co-authored-by: Austin Osagie <[email protected]>
Co-authored-by: Ian Mindich <[email protected]>
Co-authored-by: Benoit Lize <[email protected]>
Co-authored-by: johnx <[email protected]>
  • Loading branch information
13 people authored Jan 8, 2025
1 parent 05ec3d2 commit bc843a1
Show file tree
Hide file tree
Showing 106 changed files with 1,586 additions and 564 deletions.
17 changes: 12 additions & 5 deletions .github/actions/on_host_tests/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ runs:
env
# Explicitly point to libraries in extracted dir.
LD_LIBRARY_PATH="${test_dir}/out/${{ matrix.platform }}_${{ matrix.config }}/starboard"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${test_dir}/out/${{ matrix.platform }}_${{ matrix.config }}"
LD_LIBRARY_PATH="${test_dir}/starboard"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${test_dir}"
export LD_LIBRARY_PATH
# Make results dir available to the archiving step below.
results_dir="${GITHUB_WORKSPACE}/results"
echo "results_dir=${results_dir}" >> $GITHUB_ENV
failed_suites=""
cd ${test_dir}
for test_binary_path in $(ls -d out/**/*tests out/**/nplb); do
test_binary=$(basename "${test_binary_path}")
for test_binary in $(ls {*tests,nplb}); do
echo "Running tests for suite: ${test_binary}"
test_filter="*"
Expand All @@ -57,9 +57,16 @@ runs:
echo "Test filter evaluated to: ${test_filter}"
xml_path="${results_dir}/${test_binary}_testoutput.xml"
/usr/bin/xvfb-run -a --server-args="${XVFB_SERVER_ARGS}" ./$test_binary_path --gtest_filter="${test_filter}" --gtest_output="xml:${xml_path}"
/usr/bin/xvfb-run -a --server-args="${XVFB_SERVER_ARGS}" "./${test_binary}" --gtest_filter="${test_filter}" --gtest_output="xml:${xml_path}" || {
# Set exit code on failure.
failed_suites="${failed_suites} ${test_binary}"
}
done
echo "Finished running all unit tests..."
if [ -n "${failed_suites}" ]; then
echo "Test suites failed:${failed_suites}"
exit 1
fi
- name: Archive Test Results
if: success() || failure()
uses: actions/upload-artifact@v4
Expand Down
15 changes: 10 additions & 5 deletions .github/actions/process_test_results/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@ inputs:
runs:
using: "composite"
steps:
- name: Download Artifacts
- name: Download Test Results
uses: actions/download-artifact@v4
with:
name: ${{ inputs.test_results_key }}
path: results/

- name: Publish Test Report
- name: Test Summary action
continue-on-error: true
uses: mikepenz/action-junit-report@992d97d6eb2e5f3de985fbf9df6a04386874114d
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
with:
report_paths: results/*.xml
annotate_only: true
paths: "results/*.xml"
output: test-report-summary.md
show: "fail, skip"

- name: Output test summary markdown to github
run: cat test-report-summary.md >> $GITHUB_STEP_SUMMARY
shell: bash

- name: Get Datadog CLI
id: download-dd-cli
Expand Down
13 changes: 10 additions & 3 deletions .github/actions/upload_test_artifacts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ runs:
if: inputs.on_host == 'true'
run: |
set -x
cd src
tar cvf - out/${{ matrix.platform }}_${{ matrix.config }}/*tests out/${{ matrix.platform }}_${{ matrix.config }}/nplb out/${{ matrix.platform }}_${{ matrix.config }}/*.so out/${{ matrix.platform }}_${{ matrix.config }}/*.so.* out/${{ matrix.platform }}_${{ matrix.config }}/starboard/*.so.* out/${{ matrix.platform }}_${{ matrix.config }}/content/test | xz -T0 -1 -z - > test_artifacts.tar.xz
cd src/out/${{ matrix.platform }}_${{ matrix.config }}
test_deps_file="test.deps"
for test_binary in $(ls {nplb,*tests}); do
echo $test_binary
if [ -f "${test_binary}.runtime_deps" ]; then
cat "${test_binary}.runtime_deps" >> "${test_deps_file}"
fi
done
tar cvf - -T "${test_deps_file}" | xz -T0 -1 -z - > "${GITHUB_WORKSPACE}/test_artifacts.tar.xz"
shell: bash
- name: Upload On-Host Test Artifacts Archive
if: inputs.on_host == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.test_artifacts_key }}
path: src/test_artifacts.tar.xz
path: test_artifacts.tar.xz
retention-days: 3
6 changes: 3 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
matrix:
platform: ${{ fromJson(needs.initialize.outputs.platforms) }}
include: ${{ fromJson(needs.initialize.outputs.includes) }}
config: [devel, debug, qa, gold]
config: [devel, qa, gold]
container: ${{ needs.docker-build-image.outputs.docker_tag }}
env:
TEST_ARTIFACTS_KEY: ${{ matrix.platform }}_${{ matrix.name }}_test_artifacts
Expand All @@ -156,15 +156,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
# TODO(bug?): android debug builds are broken.
if: ${{ ! (startsWith(matrix.platform, 'android') && matrix.config == 'debug') }}
if: ${{ ! (contains(matrix.platform, 'android') && matrix.config == 'debug') }}
with:
path: src
# Use fetch depth of 0 to get full history for a valid build id.
fetch-depth: 0
- name: Build Cobalt
uses: ./src/.github/actions/build
# TODO(bug?): android debug builds are broken.
if: ${{ ! (startsWith(matrix.platform, 'android') && matrix.config == 'debug') }}
if: ${{ ! (contains(matrix.platform, 'android') && matrix.config == 'debug') }}
with:
targets: ${{ needs.initialize.outputs.targets }}
- name: Upload Test Artifacts
Expand Down
2 changes: 1 addition & 1 deletion build/build_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
#define BUILDFLAG_INTERNAL_MODULAR_BUILD() (0)
#endif

#if defined(COBALT_IS_RELEASE_BUILD)
#if defined(ENABLE_BUILDFLAG_COBALT_IS_RELEASE_BUILD)
#define BUILDFLAG_INTERNAL_COBALT_IS_RELEASE_BUILD() (1)
#else
#define BUILDFLAG_INTERNAL_COBALT_IS_RELEASE_BUILD() (0)
Expand Down
22 changes: 12 additions & 10 deletions cobalt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,18 @@ action("cobalt_build_info") {
]
}

test("cobalt_unittests") {
testonly = true
if (is_android) {
test("cobalt_unittests") {
testonly = true

sources = [ "//cobalt/user_agent/user_agent_platform_info_test.cc" ]
sources = [ "//cobalt/user_agent/user_agent_platform_info_test.cc" ]

deps = [
"//base/test:run_all_unittests",
"//cobalt/user_agent",
"//starboard:starboard_group",
"//testing/gmock",
"//testing/gtest",
]
deps = [
"//base/test:run_all_unittests",
"//cobalt/user_agent",
"//starboard:starboard_group",
"//testing/gmock",
"//testing/gtest",
]
}
}
10 changes: 9 additions & 1 deletion cobalt/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ jinja_template("cobalt_manifest") {
variables = [ "manifest_package=dev.cobalt.coat" ]
}

generate_jni("jni_headers") {
sources = [ "apk/app/src/main/java/dev/cobalt/coat/StarboardBridge.java" ]
}

# TODO(cobalt): Re-enable or remove disabled java files.
android_library("cobalt_apk_java") {
testonly = true
resources_package = "dev.cobalt.coat"
annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]

deps = [
":cobalt_java_resources",
":jni_headers",
"//base:base_java",
"//base:jni_java",
"//base:process_launcher_java",
"//build/android:build_java",
"//components/embedder_support/android:view_java",
Expand All @@ -57,6 +65,7 @@ android_library("cobalt_apk_java") {
"//ui/android:ui_no_recycler_view_java",
"//url:gurl_java",
]

sources = [
"apk/app/src/app/java/dev/cobalt/app/CobaltApplication.java",
"apk/app/src/app/java/dev/cobalt/app/MainActivity.java",
Expand Down Expand Up @@ -202,7 +211,6 @@ content_shell_apk_tmpl("cobalt_apk") {
":cobalt_apk_java",
]
shared_libraries = [ ":libcobalt_content_shell_content_view" ]
command_line_flags_file = "content-shell-command-line"
include_size_info = is_official_build
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import android.widget.LinearLayout;
import android.widget.Toast;
import androidx.annotation.Nullable;
import dev.cobalt.app.CobaltApplication;
import dev.cobalt.coat.javabridge.CobaltJavaScriptAndroidObject;
import dev.cobalt.coat.javabridge.CobaltJavaScriptInterface;
import dev.cobalt.coat.javabridge.H5vccPlatformService;
Expand Down Expand Up @@ -102,13 +101,10 @@ public abstract class CobaltActivity extends Activity {
protected void createContent(final Bundle savedInstanceState) {
// Initializing the command line must occur before loading the library.
if (!CommandLine.isInitialized()) {
((CobaltApplication) getApplication()).initCommandLine();
CommandLine.init(null);

// Note that appendSwitchesAndArguments excludes cobaltCommandLineParams[0]
// as the program name, and all other arguments SHOULD start with '--'.
String[] cobaltCommandLineParams =
new String[] {
"",
// Disable first run experience.
"--disable-fre",
// Disable user prompts in the first run.
Expand Down Expand Up @@ -476,6 +472,11 @@ protected void onStop() {
getStarboardBridge().onActivityStop(this);
super.onStop();

WebContents webContents = getActiveWebContents();
if (webContents != null) {
webContents.onHide();
}

if (VideoSurfaceView.getCurrentSurface() != null) {
forceCreateNewVideoSurfaceView = true;
}
Expand Down
Loading

0 comments on commit bc843a1

Please sign in to comment.