Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into AC_3439
Browse files Browse the repository at this point in the history
  • Loading branch information
rocketsroger authored Aug 12, 2019
2 parents a83d17b + 78354bc commit 43579c1
Show file tree
Hide file tree
Showing 332 changed files with 5,640 additions and 807 deletions.
4 changes: 3 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

---
<!- Text above this line will be added to the commit once "bors" merges this PR -->

### Pull Request checklist
<!-- Before submitting the PR, please address each item -->
Expand All @@ -9,4 +11,4 @@

### After merge
- [ ] **Milestone**: Make sure issues closed by this pull request are added to the [milestone](https://github.com/mozilla-mobile/android-components/milestones) of the version currently in development.
- [ ] **Breaking Changes**: If this is a breaking change, please push a draft PR on [Reference Browser](https://github.com/mozilla-mobile/reference-browser) to address the breaking issues.
- [ ] **Breaking Changes**: If this is a breaking change, please push a draft PR on [Reference Browser](https://github.com/mozilla-mobile/reference-browser) to address the breaking issues.
8 changes: 6 additions & 2 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ tasks:
$let:
decision_task_id: {$eval: as_slugid("decision_task")}
expires_in: {$fromNow: '1 year'}
user: ${event.sender.login}
user:
# GitHub adds "[bot]" to bot usernames and that doesn't validate as email.
$if: 'event.sender.login == "bors[bot]"'
then: bors
else: ${event.sender.login}

# We define the following variable at the very top, because they are used in the
# default definition
Expand Down Expand Up @@ -153,7 +157,7 @@ tasks:
metadata:
name: 'Android Components - Decision task (Pull Request #${pull_request_number})'
description: 'Building and testing Android components - triggered by [#${pull_request_number}](${pull_request_url})'
- $if: 'tasks_for == "github-push" && head_branch[:10] != "refs/tags/"'
- $if: 'tasks_for == "github-push" && head_branch[:10] != "refs/tags/" && head_branch != "staging.tmp" && head_branch != "trying.tmp"'
then:
$mergeDeep:
- {$eval: 'default_task_definition'}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Task Status](https://github.taskcluster.net/v1/repository/mozilla-mobile/android-components/master/badge.svg)](https://github.taskcluster.net/v1/repository/mozilla-mobile/android-components/master/latest)
[![codecov](https://codecov.io/gh/mozilla-mobile/android-components/branch/master/graph/badge.svg)](https://codecov.io/gh/mozilla-mobile/android-components)
[![Bors enabled](https://bors.tech/images/badge_small.svg)](https://app.bors.tech/repositories/19637)

_A collection of Android libraries to build browsers or browser-like applications._

Expand Down
13 changes: 13 additions & 0 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
status = [
"Taskcluster (push)"
]
block_labels = [
"blocked",
"work in progress"
]
[committer]
name = "MickeyMoz"
email = "[email protected]"
required_approvals = 1
delete_merged_branches = true
cut_body_after = "---"
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Gecko.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ internal object GeckoVersions {
/**
* GeckoView Nightly Version.
*/
const val nightly_version = "70.0.20190807095705"
const val nightly_version = "70.0.20190808093310"

/**
* GeckoView Beta Version.
*/
const val beta_version = "69.0.20190808090046"
const val beta_version = "69.0.20190812090043"

/**
* GeckoView Release Version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ internal class GeckoMedia(
) : Media() {
override val controller: Controller = GeckoMediaController(mediaElement)

override var metadata: Metadata = Metadata()
internal set

init {
mediaElement.delegate = MediaDelegate(this)
}
Expand All @@ -44,7 +47,7 @@ internal class GeckoMedia(
}

private class MediaDelegate(
private val media: Media
private val media: GeckoMedia
) : MediaElement.Delegate {

override fun onPlaybackStateChange(mediaElement: MediaElement, mediaState: Int) {
Expand All @@ -63,8 +66,11 @@ private class MediaDelegate(
}
}

override fun onMetadataChange(mediaElement: MediaElement, metaData: MediaElement.Metadata) {
media.metadata = Media.Metadata(metaData.duration)
}

override fun onReadyStateChange(mediaElement: MediaElement, readyState: Int) = Unit
override fun onMetadataChange(mediaElement: MediaElement, metaData: MediaElement.Metadata) = Unit
override fun onLoadProgress(mediaElement: MediaElement, progressInfo: MediaElement.LoadProgressInfo) = Unit
override fun onVolumeChange(mediaElement: MediaElement, volume: Double, muted: Boolean) = Unit
override fun onTimeChange(mediaElement: MediaElement, time: Double) = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package mozilla.components.browser.engine.gecko.media
import mozilla.components.concept.engine.media.Media
import mozilla.components.support.test.argumentCaptor
import mozilla.components.support.test.mock
import mozilla.components.test.ReflectionUtils
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
Expand Down Expand Up @@ -84,4 +85,38 @@ class GeckoMediaTest {
delegate.onPlaybackStateChange(mediaElement, MediaElement.MEDIA_STATE_PLAYING)
verify(observer).onPlaybackStateChanged(media, Media.PlaybackState.PLAYING)
}

@Test
fun `GeckoMedia exposes Metadata`() {
val mediaElement: MediaElement = mock()

val media = GeckoMedia(mediaElement)

val captor = argumentCaptor<MediaElement.Delegate>()
verify(mediaElement).delegate = captor.capture()

assertEquals(-1.0, media.metadata.duration, 0.0001)

val delegate = captor.value

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = 5.0))
assertEquals(5.0, media.metadata.duration, 0.0001)

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = 572.0))
assertEquals(572.0, media.metadata.duration, 0.0001)

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = 0.0))
assertEquals(0.0, media.metadata.duration, 0.0001)

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = -1.0))
assertEquals(-1.0, media.metadata.duration, 0.0001)
}
}

private class MockedGeckoMetadata(
duration: Double
) : MediaElement.Metadata() {
init {
ReflectionUtils.setField(this, "duration", duration)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ internal class GeckoMedia(
) : Media() {
override val controller: Controller = GeckoMediaController(mediaElement)

override var metadata: Metadata = Metadata()
internal set

init {
mediaElement.delegate = MediaDelegate(this)
}
Expand All @@ -44,7 +47,7 @@ internal class GeckoMedia(
}

private class MediaDelegate(
private val media: Media
private val media: GeckoMedia
) : MediaElement.Delegate {

override fun onPlaybackStateChange(mediaElement: MediaElement, mediaState: Int) {
Expand All @@ -63,8 +66,11 @@ private class MediaDelegate(
}
}

override fun onMetadataChange(mediaElement: MediaElement, metaData: MediaElement.Metadata) {
media.metadata = Media.Metadata(metaData.duration)
}

override fun onReadyStateChange(mediaElement: MediaElement, readyState: Int) = Unit
override fun onMetadataChange(mediaElement: MediaElement, metaData: MediaElement.Metadata) = Unit
override fun onLoadProgress(mediaElement: MediaElement, progressInfo: MediaElement.LoadProgressInfo) = Unit
override fun onVolumeChange(mediaElement: MediaElement, volume: Double, muted: Boolean) = Unit
override fun onTimeChange(mediaElement: MediaElement, time: Double) = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package mozilla.components.browser.engine.gecko.media
import mozilla.components.concept.engine.media.Media
import mozilla.components.support.test.argumentCaptor
import mozilla.components.support.test.mock
import mozilla.components.test.ReflectionUtils
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
Expand Down Expand Up @@ -84,4 +85,38 @@ class GeckoMediaTest {
delegate.onPlaybackStateChange(mediaElement, MediaElement.MEDIA_STATE_PLAYING)
verify(observer).onPlaybackStateChanged(media, Media.PlaybackState.PLAYING)
}

@Test
fun `GeckoMedia exposes Metadata`() {
val mediaElement: MediaElement = mock()

val media = GeckoMedia(mediaElement)

val captor = argumentCaptor<MediaElement.Delegate>()
verify(mediaElement).delegate = captor.capture()

assertEquals(-1.0, media.metadata.duration, 0.0001)

val delegate = captor.value

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = 5.0))
assertEquals(5.0, media.metadata.duration, 0.0001)

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = 572.0))
assertEquals(572.0, media.metadata.duration, 0.0001)

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = 0.0))
assertEquals(0.0, media.metadata.duration, 0.0001)

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = -1.0))
assertEquals(-1.0, media.metadata.duration, 0.0001)
}
}

private class MockedGeckoMetadata(
duration: Double
) : MediaElement.Metadata() {
init {
ReflectionUtils.setField(this, "duration", duration)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ internal class GeckoMedia(
) : Media() {
override val controller: Controller = GeckoMediaController(mediaElement)

override var metadata: Metadata = Metadata()
internal set

init {
mediaElement.delegate = MediaDelegate(this)
}
Expand All @@ -44,7 +47,7 @@ internal class GeckoMedia(
}

private class MediaDelegate(
private val media: Media
private val media: GeckoMedia
) : MediaElement.Delegate {
@Suppress("ComplexMethod")
override fun onPlaybackStateChange(mediaElement: MediaElement, mediaState: Int) {
Expand All @@ -63,8 +66,11 @@ private class MediaDelegate(
}
}

override fun onMetadataChange(mediaElement: MediaElement, metaData: MediaElement.Metadata) {
media.metadata = Media.Metadata(metaData.duration)
}

override fun onReadyStateChange(mediaElement: MediaElement, readyState: Int) = Unit
override fun onMetadataChange(mediaElement: MediaElement, metaData: MediaElement.Metadata) = Unit
override fun onLoadProgress(mediaElement: MediaElement, progressInfo: MediaElement.LoadProgressInfo) = Unit
override fun onVolumeChange(mediaElement: MediaElement, volume: Double, muted: Boolean) = Unit
override fun onTimeChange(mediaElement: MediaElement, time: Double) = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package mozilla.components.browser.engine.gecko.media
import mozilla.components.concept.engine.media.Media
import mozilla.components.support.test.argumentCaptor
import mozilla.components.support.test.mock
import mozilla.components.test.ReflectionUtils
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
Expand Down Expand Up @@ -67,4 +68,38 @@ class GeckoMediaTest {

assertTrue(media.controller is GeckoMediaController)
}

@Test
fun `GeckoMedia exposes Metadata`() {
val mediaElement: MediaElement = mock()

val media = GeckoMedia(mediaElement)

val captor = argumentCaptor<MediaElement.Delegate>()
verify(mediaElement).delegate = captor.capture()

assertEquals(-1.0, media.metadata.duration, 0.0001)

val delegate = captor.value

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = 5.0))
assertEquals(5.0, media.metadata.duration, 0.0001)

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = 572.0))
assertEquals(572.0, media.metadata.duration, 0.0001)

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = 0.0))
assertEquals(0.0, media.metadata.duration, 0.0001)

delegate.onMetadataChange(mediaElement, MockedGeckoMetadata(duration = -1.0))
assertEquals(-1.0, media.metadata.duration, 0.0001)
}
}

private class MockedGeckoMetadata(
duration: Double
) : MediaElement.Metadata() {
init {
ReflectionUtils.setField(this, "duration", duration)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Text for the title of an alert dialog displayed by a web page. %1$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_alert_title">Sdělení stránky %1$s:</string>
<!-- Text for the message of an auth dialog displayed by a web page.
%1$s will be replaced by the realm, %2$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_auth_message">%2$s požaduje vaše uživatelské jméno a heslo. Sdělení serveru: „%1$s“</string>
<!-- Text for the message of an auth dialog displayed by a web page. %1$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_auth_no_realm_message">%1$s požaduje vaše uživatelské jméno a heslo.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Text for the title of an alert dialog displayed by a web page. %1$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_alert_title">La página en %1$s dice:</string>
<!-- Text for the message of an auth dialog displayed by a web page.
%1$s will be replaced by the realm, %2$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_auth_message">%2$s está pidiendo tu nombre de usuario y contraseña. El sitio dice: “%1$s”</string>
<!-- Text for the message of an auth dialog displayed by a web page. %1$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_auth_no_realm_message">%1$s te está pidiendo tu nombre de usuario y contraseña.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Text for the title of an alert dialog displayed by a web page. %1$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_alert_title">Sivu osoitteessa %1$s sanoo:</string>
<!-- Text for the message of an auth dialog displayed by a web page.
%1$s will be replaced by the realm, %2$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_auth_message">%2$s pyytää käyttäjätunnusta ja salasanaa. Sivusto sanoo: ”%1$s”</string>
<!-- Text for the message of an auth dialog displayed by a web page. %1$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_auth_no_realm_message">%1$s pyytää käyttäjätunnusta ja salasanaa.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Text for the title of an alert dialog displayed by a web page. %1$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_alert_title">%1$s ਸਫ਼ੇ ਤੋਂ:</string>
<!-- Text for the message of an auth dialog displayed by a web page.
%1$s will be replaced by the realm, %2$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_auth_message">%2$s ਤੁਹਾਡੇ ਵਰਤੋਂਕਾਰ-ਨਾਂ ਅਤੇ ਪਾਸਵਰਡ ਦੀ ਮੰਗ ਕਰ ਰਹੀ ਹੈ। ਸਾਈਟ ਕਹਿੰਦੀ ਹੈ: “%1$s”</string>
<!-- Text for the message of an auth dialog displayed by a web page. %1$s will be replaced with the URL of the current page (displaying the dialog). -->
<string name="mozac_browser_engine_system_auth_no_realm_message">%1$s ਤੁਹਾਡੇ ਵਰਤੋਂਕਾਰ-ਨਾਂ ਅਤੇ ਪਾਸਵਰਡ ਦੀ ਮੰਗ ਕਰ ਰਹੀ ਹੈ। </string>
</resources>
13 changes: 13 additions & 0 deletions components/browser/errorpages/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<!-- The button that appears at the bottom of an error page. -->
<string name="mozac_browser_errorpages_page_refresh">Torna-ho a provar</string>

<!-- The document title and heading of the error page shown when the browser prevents loading a website on a restricted port. -->
<string name="mozac_browser_errorpages_port_blocked_title">El port s\'ha restringit per motius de seguretat</string>

<!-- The document title and heading of an error page. -->
<string name="mozac_browser_errorpages_malformed_uri_title_alternative">L’adreça no és vàlida</string>

</resources>
Loading

0 comments on commit 43579c1

Please sign in to comment.