Skip to content

Commit

Permalink
For mozilla-mobile#19886 - Remove tracking protection overlay CFR
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielluong authored and Amejia481 committed Aug 16, 2021
1 parent dbb6819 commit 4b2b058
Show file tree
Hide file tree
Showing 18 changed files with 5 additions and 715 deletions.
71 changes: 0 additions & 71 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3117,77 +3117,6 @@ private_browsing_mode:
- android-probes@mozilla.com
expires: "2021-08-01"

contextual_hint.tracking_protection:
display:
type: event
description: |
The enhanced tracking protection contextual hint was
displayed.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/9625
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11923
- https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877
- https://github.com/mozilla-mobile/fenix/pull/18143
- https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: "2021-07-01"
dismiss:
type: event
description: |
The enhanced tracking protection contextual hint was
dismissed
by pressing the close button
bugs:
- https://github.com/mozilla-mobile/fenix/issues/9625
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11923
- https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877
- https://github.com/mozilla-mobile/fenix/pull/18143
- https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: "2021-07-01"
outside_tap:
type: event
description: |
The user tapped outside of the etp contextual hint
(which has no effect).
bugs:
- https://github.com/mozilla-mobile/fenix/issues/9625
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11923
- https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877
- https://github.com/mozilla-mobile/fenix/pull/18143
- https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: "2021-07-01"
inside_tap:
type: event
description: |
The user tapped inside of the etp contextual hint
(which brings up the etp panel for this site).
bugs:
- https://github.com/mozilla-mobile/fenix/issues/9625
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11923
- https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877
- https://github.com/mozilla-mobile/fenix/pull/18143
- https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: "2021-07-01"

tracking_protection:
exception_added:
type: event
Expand Down
2 changes: 1 addition & 1 deletion app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ class SmokeTest {
}.openNavigationToolbar {
}.openTrackingProtectionTestPage(trackingProtectionPage.url, true) {}
enhancedTrackingProtection {
verifyEnhancedTrackingProtectionNotice()
verifyEnhancedTrackingProtectionShield()
}.closeNotificationPopup {}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,6 @@ class StrictEnhancedTrackingProtectionTest {
}
}

@Test
fun testStrictVisitContentNotification() {
val trackingProtectionTest =
TestAssetHelper.getEnhancedTrackingProtectionAsset(mockWebServer)

navigationToolbar {
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionNotice()
}.closeNotificationPopup {}
}

@Test
fun testStrictVisitContentShield() {
val trackingProtectionTest =
Expand All @@ -97,10 +84,6 @@ class StrictEnhancedTrackingProtectionTest {
navigationToolbar {
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionNotice()
}.closeNotificationPopup {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionShield()
}
Expand All @@ -114,10 +97,6 @@ class StrictEnhancedTrackingProtectionTest {
navigationToolbar {
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionNotice()
}.closeNotificationPopup {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionShield()
}.openEnhancedTrackingProtectionSheet {
Expand All @@ -133,10 +112,6 @@ class StrictEnhancedTrackingProtectionTest {
navigationToolbar {
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionNotice()
}.closeNotificationPopup {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionShield()
}.openEnhancedTrackingProtectionSheet {
Expand All @@ -163,10 +138,6 @@ class StrictEnhancedTrackingProtectionTest {
navigationToolbar {
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionNotice()
}.closeNotificationPopup {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionShield()
}.openEnhancedTrackingProtectionSheet {
Expand Down Expand Up @@ -195,10 +166,6 @@ class StrictEnhancedTrackingProtectionTest {
navigationToolbar {
}.openTrackingProtectionTestPage(trackingProtectionTest.url, true) {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionNotice()
}.closeNotificationPopup {}

enhancedTrackingProtection {
verifyEnhancedTrackingProtectionShield()
}.openEnhancedTrackingProtectionSheet {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,6 @@ fun browserScreen(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
return BrowserRobot.Transition()
}

private fun dismissOnboardingButton() = onView(withId(R.id.close_onboarding))

fun dismissTrackingOnboarding() {
mDevice.wait(Until.findObject(By.res("close_onboarding")), waitingTime)
dismissOnboardingButton().click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import androidx.test.uiautomator.UiSelector
import androidx.test.uiautomator.Until
import org.hamcrest.Matchers.containsString
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
import org.mozilla.fenix.helpers.TestHelper.packageName
import org.mozilla.fenix.helpers.click
Expand All @@ -34,8 +33,6 @@ class EnhancedTrackingProtectionRobot {

val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())!!

fun verifyEnhancedTrackingProtectionNotice() = assertEnhancedTrackingProtectionNotice()

fun verifyEnhancedTrackingProtectionShield() = assertEnhancedTrackingProtectionShield()

fun verifyEnhancedTrackingProtectionSheetStatus(status: String, state: Boolean) =
Expand Down Expand Up @@ -103,13 +100,6 @@ fun enhancedTrackingProtection(interact: EnhancedTrackingProtectionRobot.() -> U
return EnhancedTrackingProtectionRobot.Transition()
}

private fun assertEnhancedTrackingProtectionNotice() {
mDevice.waitNotNull(
Until.findObject(By.res("$packageName:id/onboarding_message")),
TestAssetHelper.waitingTime
)
}

private fun assertEnhancedTrackingProtectionShield() {
mDevice.waitNotNull(
Until.findObjects(By.descContains("Tracking Protection has blocked trackers"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiSelector
import androidx.test.uiautomator.Until
import junit.framework.TestCase.assertTrue
import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.anyOf
import org.hamcrest.CoreMatchers.containsString
Expand Down Expand Up @@ -108,7 +107,6 @@ class NavigationToolbarRobot {
onView(
anyOf(
withResourceName("browserLayout"),
withResourceName("onboarding_message"), // Req ETP dialog
withResourceName("download_button")
)
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
Expand All @@ -127,32 +125,8 @@ class NavigationToolbarRobot {

awesomeBar().perform(replaceText(url.toString()), pressImeActionButton())

val onboardingMessage =
mDevice.findObject(UiSelector().resourceId("$packageName:id/onboarding_message"))

val onboardingDisplayed = onboardingMessage.waitForExists(waitingTime)

when (etpEnabled) {
true ->
try {
assertTrue(
"Onboarding message not displayed",
onboardingDisplayed
)
} catch (e: AssertionError) {
openThreeDotMenu {
}.stopPageLoad {
if (!onboardingDisplayed) {
openThreeDotMenu {
}.refreshPage {
assertTrue(onboardingDisplayed)
}
}
}
}

false ->
onView(withResourceName("browserLayout")).check(matches(isDisplayed()))
if (!etpEnabled) {
onView(withResourceName("browserLayout")).check(matches(isDisplayed()))
}

BrowserRobot().interact()
Expand Down Expand Up @@ -206,12 +180,7 @@ class NavigationToolbarRobot {
awesomeBar().perform(replaceText(url.toString()), pressImeActionButton())

runWithIdleRes(sessionLoadedIdlingResource) {
onView(
anyOf(
ViewMatchers.withResourceName("browserLayout"),
ViewMatchers.withResourceName("onboarding_message") // Req for ETP dialog
)
)
onView(ViewMatchers.withResourceName("browserLayout"))
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
}

Expand Down Expand Up @@ -348,7 +317,6 @@ private fun assertTabButtonShortcutMenuItems() {
.check(matches(hasDescendant(withText("New tab"))))
}

private fun dismissOnboardingButton() = onView(withId(R.id.close_onboarding))
private fun urlBar() = onView(withId(R.id.toolbar))
private fun awesomeBar() = onView(withId(R.id.mozac_browser_toolbar_edit_url_view))
private fun threeDotButton() = onView(withId(R.id.mozac_browser_toolbar_menu))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import androidx.test.uiautomator.UiObject
import androidx.test.uiautomator.UiSelector
import androidx.test.uiautomator.Until
import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.anyOf
import org.hamcrest.CoreMatchers.startsWith
import org.hamcrest.Matchers
import org.junit.Assert.assertEquals
Expand Down Expand Up @@ -173,12 +172,7 @@ class SearchRobot {
browserToolbarEditView().perform(typeText(query + "\n"))

runWithIdleRes(sessionLoadedIdlingResource) {
onView(
anyOf(
ViewMatchers.withResourceName("browserLayout"),
ViewMatchers.withResourceName("onboarding_message") // Req ETP dialog
)
)
onView(ViewMatchers.withResourceName("browserLayout"))
.check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
}

Expand Down
17 changes: 0 additions & 17 deletions app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.shortcut.PwaOnboardingObserver
import org.mozilla.fenix.theme.ThemeManager
import org.mozilla.fenix.trackingprotection.TrackingProtectionOverlay

/**
* Fragment used for browsing the web within the main app.
Expand All @@ -52,8 +51,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {

private val windowFeature = ViewBoundFeatureWrapper<WindowFeature>()
private val openInAppOnboardingObserver = ViewBoundFeatureWrapper<OpenInAppOnboardingObserver>()
private val trackingProtectionOverlayObserver =
ViewBoundFeatureWrapper<TrackingProtectionOverlay>()

private var readerModeAvailable = false
private var pwaOnboardingObserver: PwaOnboardingObserver? = null
Expand Down Expand Up @@ -249,20 +246,6 @@ class BrowserFragment : BaseBrowserFragment(), UserInteractionHandler {
view = view
)
}
if (context.settings().shouldShowTrackingProtectionCfr) {
trackingProtectionOverlayObserver.set(
feature = TrackingProtectionOverlay(
context = context,
store = context.components.core.store,
lifecycleOwner = viewLifecycleOwner,
settings = context.settings(),
metrics = context.components.analytics.metrics,
getToolbar = { browserToolbarView.view }
),
owner = this,
view = view
)
}
}

override fun onStart() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ sealed class Event {
object LoginDialogPromptSave : Event()
object LoginDialogPromptNeverSave : Event()

object ContextualHintETPDisplayed : Event()
object ContextualHintETPDismissed : Event()
object ContextualHintETPOutsideTap : Event()
object ContextualHintETPInsideTap : Event()

// Tab tray
object TabsTrayOpened : Event()
object TabsTrayClosed : Event()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import org.mozilla.fenix.GleanMetrics.BookmarksManagement
import org.mozilla.fenix.GleanMetrics.BrowserSearch
import org.mozilla.fenix.GleanMetrics.Collections
import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.ContextualHintTrackingProtection
import org.mozilla.fenix.GleanMetrics.ContextualMenu
import org.mozilla.fenix.GleanMetrics.CrashReporter
import org.mozilla.fenix.GleanMetrics.CustomTab
Expand Down Expand Up @@ -642,22 +641,6 @@ private val Event.wrapper: EventWrapper<*>?
{ Onboarding.prefToggledToolbarPositionKeys.valueOf(it) }
)

is Event.ContextualHintETPDisplayed -> EventWrapper<NoExtraKeys>(
{ ContextualHintTrackingProtection.display.record(it) }
)

is Event.ContextualHintETPDismissed -> EventWrapper<NoExtraKeys>(
{ ContextualHintTrackingProtection.dismiss.record(it) }
)

is Event.ContextualHintETPInsideTap -> EventWrapper<NoExtraKeys>(
{ ContextualHintTrackingProtection.insideTap.record(it) }
)

is Event.ContextualHintETPOutsideTap -> EventWrapper<NoExtraKeys>(
{ ContextualHintTrackingProtection.outsideTap.record(it) }
)

is Event.TabsTrayOpened -> EventWrapper<NoExtraKeys>(
{ TabsTray.opened.record(it) }
)
Expand Down

0 comments on commit 4b2b058

Please sign in to comment.