From 84a7ea4292410f1b943c2843afae1415c2bd2204 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Wed, 10 Apr 2019 13:57:22 -0700 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/1525: Make BrowserPerformanceTestActivity pass through to IntentReceiverActivity. Previously, this passed through to HomeActivity, but Intent arguments were dropped. That means that actions (`-a android.intent.action.VIEW`) and URLs (`-d data:...`) were dropped, which means that Gecko itself wasn't started (and wasn't started with a session owned by Fenix itself). This simply passes through the intent to its final destination. Along the way, I also enabled remote debugging for these test configurations; it's probably not necessary, but eventually I want all automation to be controlled by that setting. See [Bug 1524673](https://bugzilla.mozilla.org/show_bug.cgi?id=1524673) for some of the motivation. This agrees with Chrome, and should generalize to future remote control protocols. --- .../fenix/browser/BrowserPerformanceTestActivity.kt | 10 ++++++++-- app/src/main/java/org/mozilla/fenix/components/Core.kt | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserPerformanceTestActivity.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserPerformanceTestActivity.kt index 547d170b8..e0cc79c8c 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserPerformanceTestActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserPerformanceTestActivity.kt @@ -8,7 +8,7 @@ import android.app.Activity import android.content.Intent import android.os.Bundle import mozilla.components.support.utils.SafeIntent -import org.mozilla.fenix.HomeActivity +import org.mozilla.fenix.IntentReceiverActivity import org.mozilla.fenix.ext.components /** @@ -22,6 +22,12 @@ class BrowserPerformanceTestActivity : Activity() { components.core.testConfig = SafeIntent(intent).extras - startActivity(Intent(this, HomeActivity::class.java)) + val intent = Intent(intent) + + intent.setClassName(applicationContext, IntentReceiverActivity::class.java.name) + + startActivity(intent) + + finish() } } diff --git a/app/src/main/java/org/mozilla/fenix/components/Core.kt b/app/src/main/java/org/mozilla/fenix/components/Core.kt index a513e9f83..18b059b75 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Core.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Core.kt @@ -43,6 +43,7 @@ class Core(private val context: Context) { testConfig?.let { builder.extras(it) + .remoteDebuggingEnabled(true) } val runtimeSettings = builder