diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /third_party/libwebrtc/build/config/android/test/resource_overlay/java | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/build/config/android/test/resource_overlay/java')
2 files changed, 59 insertions, 0 deletions
diff --git a/third_party/libwebrtc/build/config/android/test/resource_overlay/java/res_template/values/values.xml b/third_party/libwebrtc/build/config/android/test/resource_overlay/java/res_template/values/values.xml new file mode 100644 index 0000000000..973f855206 --- /dev/null +++ b/third_party/libwebrtc/build/config/android/test/resource_overlay/java/res_template/values/values.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2020 The Chromium Authors. All rights reserved. + + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. +--> + +<resources xmlns:android="http://schemas.android.com/apk/res/android"> + <integer name="{{resource_name}}">{{resource_value}}</integer> +</resources>
\ No newline at end of file diff --git a/third_party/libwebrtc/build/config/android/test/resource_overlay/java/src/org/chromium/build/resource_overlay/ResourceOverlayTest.java b/third_party/libwebrtc/build/config/android/test/resource_overlay/java/src/org/chromium/build/resource_overlay/ResourceOverlayTest.java new file mode 100644 index 0000000000..794cafac53 --- /dev/null +++ b/third_party/libwebrtc/build/config/android/test/resource_overlay/java/src/org/chromium/build/resource_overlay/ResourceOverlayTest.java @@ -0,0 +1,49 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.build.resource_overlay; + +import static org.junit.Assert.assertEquals; + +import android.content.res.Resources; +import android.support.test.InstrumentationRegistry; + +import androidx.test.filters.SmallTest; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.BaseJUnit4ClassRunner; +import org.chromium.base.test.util.Batch; + +/** + * Test for resource_overlay parameter in android_resources() build rule. + */ +@RunWith(BaseJUnit4ClassRunner.class) +@Batch(Batch.UNIT_TESTS) +public class ResourceOverlayTest { + /** + * Test that when an android_resources() target with resource_overlay=false has a resource with + * the same name but a different value as a dependency with resource_overlay=true that the value + * of the resource in the dependency is used. + */ + @Test + @SmallTest + public void testDependencyTagged() { + Resources resources = InstrumentationRegistry.getTargetContext().getResources(); + assertEquals(41, resources.getInteger(R.integer.resource_overlay_dependency_tagged_secret)); + } + + /** + * Test that when an android_resources() target with resource_overlay=true has a resource with + * the same name but different value as one of its dependencies that the value of resource in + * the target with resource_overlay=true is used. + */ + @Test + @SmallTest + public void testRootTagged() { + Resources resources = InstrumentationRegistry.getTargetContext().getResources(); + assertEquals(42, resources.getInteger(R.integer.resource_overlay_root_tagged_secret)); + } +} |