Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarks-net committed Nov 14, 2023
2 parents e5ad176 + f9fe151 commit 4e5ca51
Show file tree
Hide file tree
Showing 73 changed files with 1,088 additions and 1,107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@

<!-- The text shown inside the advanced button used to expand the advanced options. It's only shown when a website has an invalid SSL certificate. -->
<string name="mozac_browser_errorpages_security_bad_cert_advanced">ئالىي…</string>
<!-- The advanced certificate information shown when a website sends has an invalid SSL certificate. The %1$s will be replaced by the app name and %2$s will be replaced by website URL. It's only shown when a website has an invalid SSL certificate. -->
<string name="mozac_browser_errorpages_security_bad_cert_techInfo"><![CDATA[
<label>بەزىلەر تور بېكەتنى تەقلىد قىلىشقا ئۇرۇنغان بولۇشى مۇمكىن، سىز داۋاملاشتۇرماسلىقىڭىز كېرەك.</label>
<br> <br>
<label> تور بېكەتلەر گۇۋاھنامە ئارقىلىق ئۆزىنىڭ كىملىكىنى ئىسپاتلايدۇ. %1$s <b>%2$s</b> غا ئىشەنمەيدۇ ، چۈنكى ئۇنىڭ گۇۋاھنامىسىنى تارقاتقۇچى نامەلۇم، گۇۋاھنامىگە ئۆزى ئىمزا قويغان ياكى مۇلازىمېتىر توغرا بولغان ئارىلىق گۇۋاھنامىنى ئەۋەتمىگەن. </label>
]]></string>
<!-- The text shown inside the advanced options button used to go back. It's only shown if the user has expanded the advanced options. -->
<string name="mozac_browser_errorpages_security_bad_cert_back">قايتىش (تەۋسىيە)</string>

Expand Down Expand Up @@ -127,6 +133,9 @@

<!-- The document title and heading of an error page. -->
<string name="mozac_browser_errorpages_malformed_uri_title">ئىناۋەتسىز ئادرېس</string>
<string name="mozac_browser_errorpages_malformed_uri_message"><![CDATA[
<p>تەمىنلەنگەن ئادرېس تونۇيالايدىغان پىچىمدا ئەمەس. ئورۇن بالداقتىن خاتالىقنى تەكشۈرۈپ ئاندىن قايتا سىناڭ.</p>
]]></string>
<!-- The document title and heading of an error page. -->
<string name="mozac_browser_errorpages_malformed_uri_title_alternative">ئادرېس ئىناۋەتسىز</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,18 +269,21 @@ class BrowserIcons constructor(
* via an in-memory cache is attempted first, followed by an asynchronous load as a fallback.
*
* @param url The URL of the website an icon should be loaded for.
* @param iconResource Optional [IconRequest.Resource] to load the icon from.
* @param iconSize The preferred size of the icon that should be loaded.
* @param isPrivate Whether this request for this icon came from a private session.
* @param content The Composable content block to render the icon.
*/
@Composable
fun LoadableImage(
url: String,
iconResource: IconRequest.Resource? = null,
iconSize: IconRequest.Size = IconRequest.Size.DEFAULT,
isPrivate: Boolean = false,
content: @Composable IconLoaderScope.() -> Unit,
) {
val request = IconRequest(url, iconSize, emptyList(), null, isPrivate)
val iconResources = iconResource?.let { listOf(it) } ?: emptyList()
val request = IconRequest(url, iconSize, iconResources, null, isPrivate)
val iconLoaderScope = remember(request) { InternalIconLoaderScope() }

// Happy path: try to load icon synchronously from an in-memory cache.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import mozilla.components.concept.sync.SyncableStore
import mozilla.components.support.base.log.logger.Logger
import mozilla.components.support.utils.logElapsedTime
import java.io.File
import mozilla.appservices.remotetabs.InternalException as RemoteTabProviderException
import mozilla.appservices.remotetabs.TabsApiException as RemoteTabProviderException
import mozilla.appservices.remotetabs.TabsStore as RemoteTabsProvider

private const val TABS_DB_NAME = "tabs.sqlite"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import org.mockito.Mockito.spy
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.Mockito.`when`
import mozilla.appservices.remotetabs.InternalException as RemoteTabProviderException
import mozilla.appservices.remotetabs.TabsApiException as RemoteTabProviderException
import mozilla.appservices.remotetabs.TabsStore as RemoteTabsProvider

@ExperimentalCoroutinesApi
Expand Down Expand Up @@ -150,7 +150,7 @@ class RemoteTabsStorageTest {

@Test
fun `exceptions from getAll are propagated to the crash reporter`() = runTest {
val throwable = RemoteTabProviderException("test")
val throwable = RemoteTabProviderException.UnexpectedTabsException("test")
`when`(apiMock.getAll()).thenAnswer { throw throwable }

remoteTabs.getAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class FxSuggestSuggestionProvider(
onSuggestionClicked = {
loadUrlUseCase.invoke(details.url)
},
score = Int.MIN_VALUE,
metadata = buildMap {
details.clickInfo?.let { put(MetadataKeys.CLICK_INFO, it) }
details.impressionInfo?.let { put(MetadataKeys.IMPRESSION_INFO, it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ class FxSuggestSuggestionProviderTest {
assertEquals("Lasagna Come Out Tomorrow", suggestions[0].title)
assertEquals(testContext.resources.getString(R.string.sponsored_suggestion_description), suggestions[0].description)
assertNotNull(suggestions[0].icon)
assertEquals(Int.MIN_VALUE, suggestions[0].score)
assertTrue(suggestions[0].metadata.isNullOrEmpty())
assertEquals("Las Vegas", suggestions[1].title)
assertNull(suggestions[1].description)
assertNull(suggestions[1].icon)
assertEquals(Int.MIN_VALUE, suggestions[1].score)
assertTrue(suggestions[1].metadata.isNullOrEmpty())
}

Expand Down Expand Up @@ -179,6 +181,7 @@ class FxSuggestSuggestionProviderTest {
assertEquals("Las Vegas", suggestions.first().title)
assertNull(suggestions.first().description)
assertNull(suggestions.first().icon)
assertEquals(Int.MIN_VALUE, suggestions.first().score)
suggestions.first().metadata?.let {
assertEquals(setOf(FxSuggestSuggestionProvider.MetadataKeys.CLICK_INFO, FxSuggestSuggestionProvider.MetadataKeys.IMPRESSION_INFO), it.keys)

Expand Down Expand Up @@ -231,6 +234,7 @@ class FxSuggestSuggestionProviderTest {
assertEquals(1, suggestions.size)
assertEquals("Lasagna Come Out Tomorrow", suggestions.first().title)
assertEquals(testContext.resources.getString(R.string.sponsored_suggestion_description), suggestions.first().description)
assertEquals(Int.MIN_VALUE, suggestions.first().score)
suggestions.first().metadata?.let {
assertEquals(setOf(FxSuggestSuggestionProvider.MetadataKeys.CLICK_INFO, FxSuggestSuggestionProvider.MetadataKeys.IMPRESSION_INFO), it.keys)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,12 @@ class FullScreenNotificationDialog(@LayoutRes val layout: Int) :
window.setGravity(Gravity.BOTTOM)
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
}
}

lifecycleScope.launch {
delay(SNACKBAR_DURATION_LONG_MS)
dismiss()
}
// Attempt to automatically dismiss the dialog after the given duration.
lifecycleScope.launch {
delay(SNACKBAR_DURATION_LONG_MS)
dialog?.dismiss()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// These lines are generated by android-components/automation/application-services-nightly-bump.py
val VERSION = "121.20231109171254"
val VERSION = "121.20231113221234"
val CHANNEL = ApplicationServicesChannel.NIGHTLY

object ApplicationServicesConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object Versions {
const val leakcanary = "2.12"

// DO NOT MODIFY MANUALLY. This is auto-updated along with GeckoView.
const val mozilla_glean = "54.0.0"
const val mozilla_glean = "55.0.0"

const val material = "1.9.0"
const val ksp = "1.0.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object Gecko {
/**
* GeckoView Version.
*/
const val version = "121.0.20231113091505"
const val version = "121.0.20231114093013"

/**
* GeckoView channel
Expand Down
33 changes: 32 additions & 1 deletion fenix/app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8530,7 +8530,38 @@ cookie_banners:
metadata:
tags:
- Privacy&Security

cfr_shown:
type: event
description: The cookie banner cfr has been shown
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1859393
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1859393#c2
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: never
metadata:
tags:
- Privacy&Security
cfr_dismissal:
type: event
description: |
The cookie banners CFR was dismissed by the user by interacting
with the outside of the popup
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1859393
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1859393#c2
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: never
metadata:
tags:
- Privacy&Security
site_permissions:
prompt_shown:
type: event
Expand Down
1 change: 1 addition & 0 deletions fenix/app/nimbus.fml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ features:
- channel: developer
value:
enabled: true
product-recommendations: true

print:
description: A feature for printing from the share or browser menu.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.test.espresso.Espresso
import androidx.test.espresso.IdlingRegistry
import androidx.test.espresso.IdlingResource
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.matcher.IntentMatchers
import androidx.test.espresso.intent.matcher.IntentMatchers.toPackage
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.ActivityTestRule
Expand All @@ -41,6 +39,7 @@ import org.mozilla.fenix.Config
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.customtabs.ExternalAppBrowserActivity
import org.mozilla.fenix.helpers.Constants.PackageName.YOUTUBE_APP
import org.mozilla.fenix.helpers.Constants.TAG
import org.mozilla.fenix.helpers.TestHelper.mDevice
import org.mozilla.fenix.helpers.ext.waitNotNull
import org.mozilla.fenix.helpers.idlingresource.NetworkConnectionIdlingResource
Expand Down Expand Up @@ -87,13 +86,16 @@ object AppAndSystemHelper {

// Check if the downloads folder exists
if (downloadsFolder.exists() && downloadsFolder.isDirectory) {
Log.i(TAG, "clearDownloadsFolder: Verified that \"DOWNLOADS\" folder exists")
val files = downloadsFolder.listFiles()

// Check if the folder is not empty
if (files != null && files.isNotEmpty()) {
Log.i(TAG, "clearDownloadsFolder: Verified that \"DOWNLOADS\" folder is not empty")
// Delete all files in the folder
for (file in files) {
file.delete()
Log.i(TAG, "clearDownloadsFolder: Deleted $file from \"DOWNLOADS\" folder")
}
}
}
Expand All @@ -105,25 +107,27 @@ object AppAndSystemHelper {

when (enabled) {
true -> {
TestHelper.mDevice.executeShellCommand("svc data enable")
TestHelper.mDevice.executeShellCommand("svc wifi enable")
mDevice.executeShellCommand("svc data enable")
mDevice.executeShellCommand("svc wifi enable")

// Wait for network connection to be completely enabled
IdlingRegistry.getInstance().register(networkConnectedIdlingResource)
Espresso.onIdle {
IdlingRegistry.getInstance().unregister(networkConnectedIdlingResource)
}
Log.i(TAG, "setNetworkEnabled: Network connection was enabled")
}

false -> {
TestHelper.mDevice.executeShellCommand("svc data disable")
TestHelper.mDevice.executeShellCommand("svc wifi disable")
mDevice.executeShellCommand("svc data disable")
mDevice.executeShellCommand("svc wifi disable")

// Wait for network connection to be completely disabled
IdlingRegistry.getInstance().register(networkDisconnectedIdlingResource)
Espresso.onIdle {
IdlingRegistry.getInstance().unregister(networkDisconnectedIdlingResource)
}
Log.i(TAG, "setNetworkEnabled: Network connection was disabled")
}
}
}
Expand All @@ -132,23 +136,28 @@ object AppAndSystemHelper {
return try {
val packageManager = InstrumentationRegistry.getInstrumentation().context.packageManager
packageManager.getApplicationInfo(packageName, 0).enabled
} catch (exception: PackageManager.NameNotFoundException) {
} catch (e: PackageManager.NameNotFoundException) {
Log.i(TAG, "isPackageInstalled: Catch block - ${e.message}")
false
}
}

fun assertExternalAppOpens(appPackageName: String) {
if (isPackageInstalled(appPackageName)) {
Log.i(TAG, "assertExternalAppOpens: $appPackageName is installed on device")
try {
Intents.intended(IntentMatchers.toPackage(appPackageName))
Log.i(TAG, "assertExternalAppOpens: Try block")
intended(toPackage(appPackageName))
Log.i(TAG, "assertExternalAppOpens: Matched intent to $appPackageName")
} catch (e: AssertionFailedError) {
e.printStackTrace()
Log.i(TAG, "assertExternalAppOpens: Catch block - ${e.message}")
}
} else {
TestHelper.mDevice.waitNotNull(
mDevice.waitNotNull(
Until.findObject(By.text("Could not open file")),
TestAssetHelper.waitingTime,
)
Log.i(TAG, "assertExternalAppOpens: Verified \"Could not open file\" message")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ object MatcherHelper {
fun assertItemWithResIdExists(vararg appItems: UiObject, exists: Boolean = true) {
if (exists) {
for (appItem in appItems) {
assertTrue(appItem.waitForExists(waitingTime))
assertTrue("${appItem.selector} does not exist", appItem.waitForExists(waitingTime))
Log.i(TAG, "assertItemWithResIdExists: Verified ${appItem.selector} exists")
}
} else {
for (appItem in appItems) {
assertFalse(appItem.waitForExists(waitingTimeShort))
assertFalse("${appItem.selector} exists", appItem.waitForExists(waitingTimeShort))
Log.i(TAG, "assertItemWithResIdExists: Verified ${appItem.selector} does not exist")
}
}
Expand All @@ -76,10 +76,10 @@ object MatcherHelper {
fun assertItemContainingTextExists(vararg appItems: UiObject, exists: Boolean = true) {
for (appItem in appItems) {
if (exists) {
assertTrue(appItem.waitForExists(waitingTime))
assertTrue("${appItem.selector} does not exist", appItem.waitForExists(waitingTime))
Log.i(TAG, "assertItemContainingTextExists: Verified ${appItem.selector} exists")
} else {
assertFalse(appItem.waitForExists(waitingTimeShort))
assertFalse("${appItem.selector} exists", appItem.waitForExists(waitingTimeShort))
Log.i(TAG, "assertItemContainingTextExists: Verified ${appItem.selector} does not exist")
}
}
Expand All @@ -88,18 +88,24 @@ object MatcherHelper {
fun assertItemWithDescriptionExists(vararg appItems: UiObject, exists: Boolean = true) {
for (appItem in appItems) {
if (exists) {
assertTrue(appItem.waitForExists(waitingTime))
assertTrue("${appItem.selector} does not exist", appItem.waitForExists(waitingTime))
Log.i(TAG, "assertItemContainingTextExists: Verified ${appItem.selector} exists")
} else {
assertFalse(appItem.waitForExists(waitingTimeShort))
assertFalse("${appItem.selector} exists", appItem.waitForExists(waitingTimeShort))
Log.i(TAG, "assertItemContainingTextExists: Verified ${appItem.selector} does not exist")
}
}
}

fun assertCheckedItemWithResIdExists(vararg appItems: UiObject) {
fun assertCheckedItemWithResIdExists(vararg appItems: UiObject, exists: Boolean = true) {
for (appItem in appItems) {
assertTrue(appItem.waitForExists(waitingTime))
if (exists) {
assertTrue("${appItem.selector} does not exist", appItem.waitForExists(waitingTime))
Log.i(TAG, "assertCheckedItemWithResIdExists: Verified ${appItem.selector} exists")
} else {
assertFalse("${appItem.selector} exists", appItem.waitForExists(waitingTimeShort))
Log.i(TAG, "assertItemContainingTextExists: Verified ${appItem.selector} does not exist")
}
}
}

Expand All @@ -118,9 +124,11 @@ object MatcherHelper {
fun assertItemWithResIdAndTextExists(vararg appItems: UiObject, exists: Boolean = true) {
for (appItem in appItems) {
if (exists) {
assertTrue(appItem.waitForExists(waitingTime))
assertTrue("${appItem.selector} does not exist", appItem.waitForExists(waitingTime))
Log.i(TAG, "assertItemWithResIdExists: Verified ${appItem.selector} exists")
} else {
assertFalse(appItem.waitForExists(waitingTimeShort))
assertFalse("${appItem.selector} exists", appItem.waitForExists(waitingTimeShort))
Log.i(TAG, "assertItemWithResIdExists: Verified ${appItem.selector} does not exist")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package org.mozilla.fenix.helpers

import android.content.Context
import android.net.Uri
import android.util.Log
import android.view.View
import androidx.test.core.app.launchActivity
import androidx.test.espresso.Espresso.onView
Expand All @@ -32,6 +33,7 @@ import org.junit.Assert
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.Constants.TAG
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndText
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeShort
Expand Down Expand Up @@ -120,6 +122,7 @@ object TestHelper {
mDevice.findObject(UiSelector().resourceId("$packageName:id/toolbar"))
while (!toolbar.waitForExists(waitingTimeShort)) {
mDevice.pressBack()
Log.i(TAG, "exitMenu: Exiting app settings menus using device back button")
}
}

Expand Down
Loading

0 comments on commit 4e5ca51

Please sign in to comment.