Skip to content

Commit

Permalink
Bug 1654207: Remove LEGACY_TAG_PINGS from the Android GleanDebugActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinYing-Li committed Feb 19, 2021
1 parent d3d4085 commit feb8636
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class GleanDebugActivity : Activity() {
* The value must match the pattern `[a-zA-Z0-9-]{1,20}`.
*/
const val TAG_DEBUG_VIEW_EXTRA_KEY = "debugViewTag"
const val LEGACY_TAG_PINGS = "tagPings"

/**
* Tags all outgoing pings as debug pings to make them available for real-time validation.
Expand Down Expand Up @@ -94,7 +93,7 @@ class GleanDebugActivity : Activity() {
// Make sure that at least one of the supported commands was used.
val supportedCommands = listOf(
SEND_PING_EXTRA_KEY, LOG_PINGS_EXTRA_KEY, NEXT_ACTIVITY_TO_RUN,
TAG_DEBUG_VIEW_EXTRA_KEY, SOURCE_TAGS_KEY, LEGACY_TAG_PINGS
TAG_DEBUG_VIEW_EXTRA_KEY, SOURCE_TAGS_KEY
)

var nextActivityName: String? = null
Expand All @@ -114,13 +113,6 @@ class GleanDebugActivity : Activity() {
// Set the debug view tag, if the tag is invalid it won't be set
debugViewTag?.let {
Glean.setDebugViewTag(debugViewTag)
} ?: run {
// If the 'debugViewTag' was not used, try to look for the legacy
// way of setting debug view tags. We should leave this block of
// code around at most until December 2020.
intent.getStringExtra(LEGACY_TAG_PINGS)?.let { legacyTag ->
Glean.setDebugViewTag(legacyTag)
}
}

val logPings: Boolean? = intent.getBooleanExtra(LOG_PINGS_EXTRA_KEY, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,39 +214,6 @@ class GleanDebugActivityTest {
server.shutdown()
}

@Test
fun `pings are correctly tagged using legacy tagPings`() {
val pingTag = "legacy-debug-ID"

// Use the test client in the Glean configuration
val context = ApplicationProvider.getApplicationContext<Context>()
resetGlean(context, Glean.configuration.copy(
httpClient = TestPingTagClient(debugHeaderValue = pingTag)
))

// Create a custom ping for testing. Since we're testing headers,
// it's fine for this to be empty.
val customPing = PingType<NoReasonCodes>(
name = "custom",
includeClientId = false,
sendIfEmpty = true,
reasonCodes = listOf()
)

// Set the extra values and start the intent.
val intent = Intent(ApplicationProvider.getApplicationContext<Context>(),
GleanDebugActivity::class.java)
intent.putExtra(GleanDebugActivity.SEND_PING_EXTRA_KEY, "metrics")
intent.putExtra(GleanDebugActivity.LEGACY_TAG_PINGS, pingTag)
launch<GleanDebugActivity>(intent)

customPing.submit()

// This will trigger the call to `fetch()` in the TestPingTagClient which is where the
// test assertions will occur
triggerWorkManager(context)
}

@Test
fun `pings are correctly tagged using sourceTags`() {
val testTags = setOf("tag1", "tag2")
Expand Down

0 comments on commit feb8636

Please sign in to comment.