Make sure ChromePublic.apk is to run benchmarks for perf bisects, CQ and pert tryjobs..

This change ensures that the test command will use --browser=android-chromium (ChromePublic.apk)
on android platform, benchmarks are not longer uses andorid-chrome-shell (ChromeShell.apk).
BUG=503171

Review URL: https://codereview.chromium.org/1226273003

Cr-Commit-Position: refs/heads/master@{#339190}
diff --git a/tools/auto_bisect/bisect_perf_regression.py b/tools/auto_bisect/bisect_perf_regression.py
index 9539b68b..7fc16db 100755
--- a/tools/auto_bisect/bisect_perf_regression.py
+++ b/tools/auto_bisect/bisect_perf_regression.py
@@ -1238,37 +1238,6 @@
   def _IsBisectModeStandardDeviation(self):
     return self.opts.bisect_mode in [bisect_utils.BISECT_MODE_STD_DEV]
 
-  def GetCompatibleCommand(self, command_to_run, revision, depot):
-    """Return a possibly modified test command depending on the revision.
-
-    Prior to crrev.com/274857 *only* android-chromium-testshell
-    Then until crrev.com/276628 *both* (android-chromium-testshell and
-    android-chrome-shell) work. After that rev 276628 *only*
-    android-chrome-shell works. The bisect_perf_regression.py script should
-    handle these cases and set appropriate browser type based on revision.
-    """
-    if self.opts.target_platform in ['android']:
-      # When its a third_party depot, get the chromium revision.
-      if depot != 'chromium':
-        revision = bisect_utils.CheckRunGit(
-            ['rev-parse', 'HEAD'], cwd=self.src_cwd).strip()
-      commit_position = source_control.GetCommitPosition(revision,
-                                                         cwd=self.src_cwd)
-      if not commit_position:
-        return command_to_run
-      cmd_re = re.compile(r'--browser=(?P<browser_type>\S+)')
-      matches = cmd_re.search(command_to_run)
-      if bisect_utils.IsStringInt(commit_position) and matches:
-        cmd_browser = matches.group('browser_type')
-        if commit_position <= 274857 and cmd_browser == 'android-chrome-shell':
-          return command_to_run.replace(cmd_browser,
-                                        'android-chromium-testshell')
-        elif (commit_position >= 276628 and
-              cmd_browser == 'android-chromium-testshell'):
-          return command_to_run.replace(cmd_browser,
-                                        'android-chrome-shell')
-    return command_to_run
-
   def RunPerformanceTestAndParseResults(
       self, command_to_run, metric, reset_on_first_run=False,
       upload_on_last_run=False, results_label=None, test_run_multiplier=1,
@@ -1542,9 +1511,6 @@
               BUILD_RESULT_FAIL)
     after_build_time = time.time()
 
-    # Possibly alter the command.
-    command = self.GetCompatibleCommand(command, revision, depot)
-
     # Run the command and get the results.
     results = self.RunPerformanceTestAndParseResults(
         command, metric, test_run_multiplier=test_run_multiplier)
diff --git a/tools/auto_bisect/bisect_perf_regression_test.py b/tools/auto_bisect/bisect_perf_regression_test.py
index 6d96d81..15c6833e 100644
--- a/tools/auto_bisect/bisect_perf_regression_test.py
+++ b/tools/auto_bisect/bisect_perf_regression_test.py
@@ -285,65 +285,6 @@
     self._AssertParseResult([], '{}kb')
     self._AssertParseResult([], '{XYZ}kb')
 
-  def _AssertCompatibleCommand(
-      self, expected_command, original_command, revision, target_platform):
-    """Tests the modification of the command that might be done.
-
-    This modification to the command is done in order to get a Telemetry
-    command that works; before some revisions, the browser name that Telemetry
-    expects is different in some cases, but we want it to work anyway.
-
-    Specifically, only for android:
-      After r276628, only android-chrome-shell works.
-      Prior to r274857, only android-chromium-testshell works.
-      In the range [274857, 276628], both work.
-    """
-    bisect_options = bisect_perf_regression.BisectOptions()
-    bisect_options.output_buildbot_annotations = None
-    bisect_instance = bisect_perf_regression.BisectPerformanceMetrics(
-        bisect_options, os.getcwd())
-    bisect_instance.opts.target_platform = target_platform
-    git_revision = source_control.ResolveToRevision(
-        revision, 'chromium', bisect_utils.DEPOT_DEPS_NAME, 100)
-    depot = 'chromium'
-    command = bisect_instance.GetCompatibleCommand(
-        original_command, git_revision, depot)
-    self.assertEqual(expected_command, command)
-
-  def testGetCompatibleCommand_ChangeToTestShell(self):
-    # For revisions <= r274857, only android-chromium-testshell is used.
-    self._AssertCompatibleCommand(
-        'tools/perf/run_benchmark -v --browser=android-chromium-testshell foo',
-        'tools/perf/run_benchmark -v --browser=android-chrome-shell foo',
-        274857, 'android')
-
-  def testGetCompatibleCommand_ChangeToShell(self):
-    # For revisions >= r276728, only android-chrome-shell can be used.
-    self._AssertCompatibleCommand(
-        'tools/perf/run_benchmark -v --browser=android-chrome-shell foo',
-        'tools/perf/run_benchmark -v --browser=android-chromium-testshell foo',
-        276628, 'android')
-
-  def testGetCompatibleCommand_NoChange(self):
-    # For revisions < r276728, android-chromium-testshell can be used.
-    self._AssertCompatibleCommand(
-        'tools/perf/run_benchmark -v --browser=android-chromium-testshell foo',
-        'tools/perf/run_benchmark -v --browser=android-chromium-testshell foo',
-        274858, 'android')
-    # For revisions > r274857, android-chrome-shell can be used.
-    self._AssertCompatibleCommand(
-        'tools/perf/run_benchmark -v --browser=android-chrome-shell foo',
-        'tools/perf/run_benchmark -v --browser=android-chrome-shell foo',
-        274858, 'android')
-
-  def testGetCompatibleCommand_NonAndroidPlatform(self):
-    # In most cases, there's no need to change Telemetry command.
-    # For revisions >= r276728, only android-chrome-shell can be used.
-    self._AssertCompatibleCommand(
-        'tools/perf/run_benchmark -v --browser=release foo',
-        'tools/perf/run_benchmark -v --browser=release foo',
-        276628, 'chromium')
-
   # This method doesn't reference self; it fails if an error is thrown.
   # pylint: disable=R0201
   def testDryRun(self):
diff --git a/tools/auto_bisect/builder.py b/tools/auto_bisect/builder.py
index 9a93089..97b01f7 100644
--- a/tools/auto_bisect/builder.py
+++ b/tools/auto_bisect/builder.py
@@ -145,10 +145,17 @@
 
   # TODO(qyearsley): Make this a class method and verify that it works with
   # a unit test.
+  # TODO (prasadv): Remove android-chrome-shell target once we confirm there are
+  # no pending bisect jobs with this in command.
   # pylint: disable=R0201
   def _GetTargets(self):
     """Returns a list of build targets."""
-    return ['chrome_shell_apk', 'cc_perftests_apk', 'android_tools']
+    return [
+        'chrome_public_apk',
+        'chrome_shell_apk',
+        'cc_perftests_apk',
+        'android_tools'
+    ]
 
   def Build(self, depot, opts):
     """Builds the android content shell and other necessary tools.
diff --git a/tools/auto_bisect/configs/android.perf_test.sunspider.cfg b/tools/auto_bisect/configs/android.perf_test.sunspider.cfg
index 16c0ece..87238fc 100644
--- a/tools/auto_bisect/configs/android.perf_test.sunspider.cfg
+++ b/tools/auto_bisect/configs/android.perf_test.sunspider.cfg
@@ -2,7 +2,7 @@
 # http://build.chromium.org/p/tryserver.chromium.perf/builders/linux_perf_bisect/builds/689
 
 config = {
-  'command': 'tools/perf/run_benchmark -v --browser=android-chrome-shell sunspider',
+  'command': 'tools/perf/run_benchmark -v --browser=android-chromium sunspider',
   "max_time_minutes": "10",
   "repeat_count": "1",
   "truncate_percent": "0"
diff --git a/tools/auto_bisect/configs/try.py b/tools/auto_bisect/configs/try.py
index 0e2dd8d..e34593f 100755
--- a/tools/auto_bisect/configs/try.py
+++ b/tools/auto_bisect/configs/try.py
@@ -33,11 +33,9 @@
     'win': ['win_perf_bisect', 'win_8_perf_bisect', 'win_xp_perf_bisect'],
     'winx64': ['win_x64_perf_bisect'],
     'android': [
-        'android_gn_perf_bisect',
         'android_nexus4_perf_bisect',
         'android_nexus5_perf_bisect',
         'android_nexus7_perf_bisect',
-        'android_nexus10_perf_bisect',
     ],
 }
 SVN_URL = 'svn://svn.chromium.org/chrome-try/try-perf'
diff --git a/tools/run-bisect-perf-regression.py b/tools/run-bisect-perf-regression.py
index b0fdf4c..27c0c77 100755
--- a/tools/run-bisect-perf-regression.py
+++ b/tools/run-bisect-perf-regression.py
@@ -228,7 +228,10 @@
       raise RuntimeError('CrOS build selected, but BISECT_CROS_IP or'
           'BISECT_CROS_BOARD undefined.')
   elif 'android' in config['command']:
-    if 'android-chrome-shell' in config['command']:
+    # TODO (prasadv): Remove android-chrome-shell check once we confirm that
+    # there are no pending bisect jobs with this in command.
+    if any(item in config['command']
+           for item in ['android-chrome-shell', 'android-chromium']):
       opts_dict['target_platform'] = 'android'
     elif 'android-chrome' in config['command']:
       opts_dict['target_platform'] = 'android-chrome'
@@ -528,7 +531,10 @@
 
   # Possibly set the target platform name based on the browser name in a
   # Telemetry command.
-  if 'android-chrome-shell' in config['command']:
+  # TODO (prasadv): Remove android-chrome-shell check once we confirm there are
+  # no pending bisect jobs with this in command.
+  if any(item in config['command']
+         for item in ['android-chrome-shell', 'android-chromium']):
     cmd.extend(['--target_platform', 'android'])
   elif 'android-chrome' in config['command']:
     cmd.extend(['--target_platform', 'android-chrome'])
@@ -583,7 +589,7 @@
 def _GetBrowserType(bot_platform):
   """Gets the browser type to be used in the run benchmark command."""
   if bot_platform == 'android':
-    return 'android-chrome-shell'
+    return 'android-chromium'
   elif 'x64' in bot_platform:
     return 'release_x64'
 
@@ -621,7 +627,10 @@
     opts_dict['use_goma'] = config['use_goma']
   if 'goma_dir' in config:
     opts_dict['goma_dir'] = config['goma_dir']
-  if 'android-chrome-shell' in opts_dict['command']:
+  # TODO (prasadv): Remove android-chrome-shell check once we confirm there are
+  # no pending bisect jobs with this in command.
+  if any(item in opts_dict['command']
+         for item in ['android-chrome-shell', 'android-chromium']):
     opts_dict['target_platform'] = 'android'
 
   return bisect_perf_regression.BisectOptions.FromDict(opts_dict)
diff --git a/tools/telemetry/telemetry/internal/backends/remote/trybot_browser_finder.py b/tools/telemetry/telemetry/internal/backends/remote/trybot_browser_finder.py
index b68bd54..b9eeac65 100644
--- a/tools/telemetry/telemetry/internal/backends/remote/trybot_browser_finder.py
+++ b/tools/telemetry/telemetry/internal/backends/remote/trybot_browser_finder.py
@@ -151,7 +151,7 @@
     for index, arg in enumerate(arguments):
       if arg.startswith('--browser='):
         if bot_platform == 'android':
-          arguments[index] = '--browser=android-chrome-shell'
+          arguments[index] = '--browser=android-chromium'
         elif any('x64' in bot for bot in self._builder_names[bot_platform]):
           arguments[index] = '--browser=release_x64'
           target_arch = 'x64'
diff --git a/tools/telemetry/telemetry/internal/backends/remote/trybot_browser_finder_unittest.py b/tools/telemetry/telemetry/internal/backends/remote/trybot_browser_finder_unittest.py
index e1f707a..bcec0fe 100644
--- a/tools/telemetry/telemetry/internal/backends/remote/trybot_browser_finder_unittest.py
+++ b/tools/telemetry/telemetry/internal/backends/remote/trybot_browser_finder_unittest.py
@@ -349,7 +349,7 @@
     self.assertEquals(
         ('config = {\n'
          '  "command": "./tools/perf/run_benchmark '
-         '--browser=android-chrome-shell sunspider",\n'
+         '--browser=android-chromium sunspider",\n'
          '  "max_time_minutes": "120",\n'
          '  "repeat_count": "1",\n'
          '  "target_arch": "ia32",\n'