add extensions.allow-non-mpc-extensions to user_prefs
This commit is contained in:
Родитель
0cd152c993
Коммит
67cfa2e9c8
|
@ -21,4 +21,4 @@ spark-submit \
|
|||
--bucket example_bucket \
|
||||
--from 20160412 \
|
||||
--to 20160428
|
||||
```
|
||||
```
|
||||
|
|
|
@ -212,10 +212,19 @@ object MainSummaryView {
|
|||
}
|
||||
|
||||
def getUserPrefs(prefs: JValue): Option[Row] = {
|
||||
prefs \ "dom.ipc.processCount" match {
|
||||
case JInt(pc) => Some(Row(pc.toInt))
|
||||
val pc = prefs \ "dom.ipc.processCount" match {
|
||||
case JInt(pc) => pc.toInt
|
||||
case _ => None
|
||||
}
|
||||
val anme = prefs \ "extensions.allow-non-mpc-extensions" match {
|
||||
case JBool(x) => x
|
||||
case _ => None
|
||||
}
|
||||
val row = Row(pc, anme)
|
||||
row match {
|
||||
case Row(None, None) => None
|
||||
case nonempty => Some(nonempty)
|
||||
}
|
||||
}
|
||||
|
||||
def getExperiments(experiments: JValue): Option[Map[String, String]] = {
|
||||
|
@ -630,7 +639,8 @@ object MainSummaryView {
|
|||
|
||||
// Data for user prefs
|
||||
def buildUserPrefsSchema = StructType(List(
|
||||
StructField("dom_ipc_process_count", IntegerType, nullable = true) // dom.ipc.processCount
|
||||
StructField("dom_ipc_process_count", IntegerType, nullable = true), // dom.ipc.processCount
|
||||
StructField("extensions_allow_non_mpc_extensions", BooleanType, nullable = true) // extensions.allow-non-mpc-extensions
|
||||
))
|
||||
|
||||
def buildScalarSchema(scalarDefinitions: List[(String, ScalarDefinition)]): List[StructField] = {
|
||||
|
|
|
@ -932,7 +932,7 @@ class MainSummaryViewTest extends FlatSpec with Matchers{
|
|||
}
|
||||
|
||||
"User prefs" can "be extracted" in {
|
||||
// Contains prefs, but not dom.ipc.processCount:
|
||||
// Contains prefs, but not dom.ipc.processCount or extensions.allow-non-mpc-extensions:
|
||||
val json1 = parse(
|
||||
"""
|
||||
|{
|
||||
|
@ -962,7 +962,7 @@ class MainSummaryViewTest extends FlatSpec with Matchers{
|
|||
""".stripMargin)
|
||||
MainSummaryView.getUserPrefs(json2 \ "environment" \ "settings" \ "userPrefs") should be (None)
|
||||
|
||||
// Contains prefs, including dom.ipc.processCount
|
||||
// Contains prefs, including dom.ipc.processCount and extensions.allow-non-mpc-extensions
|
||||
val json3 = parse(
|
||||
"""
|
||||
|{
|
||||
|
@ -971,15 +971,16 @@ class MainSummaryViewTest extends FlatSpec with Matchers{
|
|||
| "userPrefs": {
|
||||
| "dom.ipc.processCount": 2,
|
||||
| "browser.newtabpage.enhanced": true,
|
||||
| "browser.startup.page": 3
|
||||
| "browser.startup.page": 3,
|
||||
| "extensions.allow-non-mpc-extensions": true
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
|}
|
||||
""".stripMargin)
|
||||
MainSummaryView.getUserPrefs(json3 \ "environment" \ "settings" \ "userPrefs") should be (Some(Row(2)))
|
||||
MainSummaryView.getUserPrefs(json3 \ "environment" \ "settings" \ "userPrefs") should be (Some(Row(2, true)))
|
||||
|
||||
// Contains dom.ipc.processCount with a bogus data type
|
||||
// Contains dom.ipc.processCount and extensions.allow-non-mpc-extensions with bogus data types
|
||||
val json4 = parse(
|
||||
"""
|
||||
|{
|
||||
|
@ -988,7 +989,8 @@ class MainSummaryViewTest extends FlatSpec with Matchers{
|
|||
| "userPrefs": {
|
||||
| "dom.ipc.processCount": "2",
|
||||
| "browser.newtabpage.enhanced": true,
|
||||
| "browser.startup.page": 3
|
||||
| "browser.startup.page": 3,
|
||||
| "extensions.allow-non-mpc-extensions": 1
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
|
@ -1007,7 +1009,42 @@ class MainSummaryViewTest extends FlatSpec with Matchers{
|
|||
|}
|
||||
""".stripMargin)
|
||||
MainSummaryView.getUserPrefs(json5 \ "environment" \ "settings" \ "userPrefs") should be (None)
|
||||
}
|
||||
|
||||
// Contains dom.ipc.processCount but not extensions.allow-non-mpc-extensions
|
||||
val json6 = parse(
|
||||
"""
|
||||
|{
|
||||
| "environment": {
|
||||
| "settings": {
|
||||
| "userPrefs": {
|
||||
| "dom.ipc.processCount": 4,
|
||||
| "browser.newtabpage.enhanced": true,
|
||||
| "browser.startup.page": 3
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
|}
|
||||
""".stripMargin)
|
||||
MainSummaryView.getUserPrefs(json6 \ "environment" \ "settings" \ "userPrefs") should be (Some(Row(4, None)))
|
||||
|
||||
// Contains extensions.allow-non-mpc-extensions but not dom.ipc.processCount
|
||||
val json7 = parse(
|
||||
"""
|
||||
|{
|
||||
| "environment": {
|
||||
| "settings": {
|
||||
| "userPrefs": {
|
||||
| "browser.newtabpage.enhanced": true,
|
||||
| "browser.startup.page": 3,
|
||||
| "extensions.allow-non-mpc-extensions": false
|
||||
| }
|
||||
| }
|
||||
| }
|
||||
|}
|
||||
""".stripMargin)
|
||||
MainSummaryView.getUserPrefs(json7 \ "environment" \ "settings" \ "userPrefs") should be (Some(Row(None, false)))
|
||||
|
||||
}
|
||||
|
||||
"Engagement measures" can "be extracted" in {
|
||||
// Doesn't have scalars
|
||||
|
|
Загрузка…
Ссылка в новой задаче