Set default Skia Gold session type

Sets the default session type for Skia Gold to be
OutputManagerlessSkiaGoldSession. This is what was being used by all
implementations except the Android instrumentation tests, so we are able
to remove some duplicate code and unnecessary child classes by setting
the default in the base implementation.

Bug: 1443021
Change-Id: I69a7a884736ae5ce39cc20228614e4d78a4d1c95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4514682
Reviewed-by: Sven Zheng <[email protected]>
Reviewed-by: Mark Pearson <[email protected]>
Reviewed-by: Andrew Grieve <[email protected]>
Commit-Queue: Brian Sheedy <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1142776}
diff --git a/build/android/test_runner.pydeps b/build/android/test_runner.pydeps
index 5c1cd13..3414349 100644
--- a/build/android/test_runner.pydeps
+++ b/build/android/test_runner.pydeps
@@ -134,6 +134,7 @@
 ../gn_helpers.py
 ../print_python_deps.py
 ../skia_gold_common/__init__.py
+../skia_gold_common/output_managerless_skia_gold_session.py
 ../skia_gold_common/skia_gold_properties.py
 ../skia_gold_common/skia_gold_session.py
 ../skia_gold_common/skia_gold_session_manager.py
diff --git a/build/skia_gold_common/skia_gold_properties.py b/build/skia_gold_common/skia_gold_properties.py
index 68a175f..6ff37429 100644
--- a/build/skia_gold_common/skia_gold_properties.py
+++ b/build/skia_gold_common/skia_gold_properties.py
@@ -29,7 +29,10 @@
 
 class SkiaGoldProperties():
   def __init__(self, args: ParsedCmdArgs):
-    """Abstract class to validate and store properties related to Skia Gold.
+    """Class to validate and store properties related to Skia Gold.
+
+    The base implementation is usable on its own, but is meant to be overridden
+    as necessary.
 
     Args:
       args: The parsed arguments from an argparse.ArgumentParser.
diff --git a/build/skia_gold_common/skia_gold_session_manager.py b/build/skia_gold_common/skia_gold_session_manager.py
index 976a72e..300ddf89 100644
--- a/build/skia_gold_common/skia_gold_session_manager.py
+++ b/build/skia_gold_common/skia_gold_session_manager.py
@@ -7,6 +7,7 @@
 import tempfile
 from typing import Optional, Type, Union
 
+from skia_gold_common import output_managerless_skia_gold_session
 from skia_gold_common import skia_gold_properties
 from skia_gold_common import skia_gold_session
 
@@ -16,11 +17,14 @@
 class SkiaGoldSessionManager():
   def __init__(self, working_dir: str,
                gold_properties: skia_gold_properties.SkiaGoldProperties):
-    """Abstract class to manage one or more skia_gold_session.SkiaGoldSessions.
+    """Class to manage one or more skia_gold_session.SkiaGoldSessions.
 
     A separate session is required for each instance/corpus/keys_file
     combination, so this class will lazily create them as necessary.
 
+    The base implementation is usable on its own, but is meant to be overridden
+    as necessary.
+
     Args:
       working_dir: The working directory under which each individual
           SkiaGoldSessions' working directory will be created.
@@ -86,7 +90,7 @@
     Returns:
       A reference to a SkiaGoldSession class.
     """
-    raise NotImplementedError
+    return output_managerless_skia_gold_session.OutputManagerlessSkiaGoldSession
 
 
 def _GetKeysAsDict(keys_input: KeysInputType) -> dict:
diff --git a/chrome/test/variations/fixtures/skia_gold.py b/chrome/test/variations/fixtures/skia_gold.py
index 1e7f3d5..2d60ece 100644
--- a/chrome/test/variations/fixtures/skia_gold.py
+++ b/chrome/test/variations/fixtures/skia_gold.py
@@ -19,7 +19,6 @@
 # to the search path.
 from chrome.test.variations.test_utils import SRC_DIR
 sys.path.append(os.path.join(SRC_DIR, 'build'))
-from skia_gold_common import output_managerless_skia_gold_session as omsgs
 from skia_gold_common import skia_gold_properties as sgp
 from skia_gold_common import skia_gold_session_manager as sgsm
 from skia_gold_common.skia_gold_session import SkiaGoldSession
@@ -33,11 +32,6 @@
   skia_options, _ = parser.parse_known_args()
   return skia_options
 
-class _VariationsSkiaGoldSessionManager(sgsm.SkiaGoldSessionManager):
-  @staticmethod
-  def GetSessionClass():
-    return omsgs.OutputManagerlessSkiaGoldSession
-
 
 @attr.attrs()
 class VariationsSkiaGoldUtil:
@@ -90,7 +84,7 @@
 
   skia_gold_properties = sgp.SkiaGoldProperties(
     args=_get_skia_gold_args())
-  skia_gold_session_manager = _VariationsSkiaGoldSessionManager(
+  skia_gold_session_manager = SkiaGoldSessionManager(
     skia_tmp_dir,
     skia_gold_properties
   )
diff --git a/content/test/gpu/gpu_tests/__init__.py b/content/test/gpu/gpu_tests/__init__.py
index 9d89cb98..d81a4a8c 100644
--- a/content/test/gpu/gpu_tests/__init__.py
+++ b/content/test/gpu/gpu_tests/__init__.py
@@ -2,4 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import gpu_path_util
 from gpu_path_util import setup_telemetry_paths  # pylint: disable=unused-import
+
+gpu_path_util.AddDirToPathIfNeeded(gpu_path_util.CHROMIUM_SRC_DIR, 'build')
diff --git a/content/test/gpu/gpu_tests/skia_gold/__init__.py b/content/test/gpu/gpu_tests/skia_gold/__init__.py
deleted file mode 100644
index 8b0d81aa..0000000
--- a/content/test/gpu/gpu_tests/skia_gold/__init__.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright 2020 The Chromium Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import gpu_path_util
-
-gpu_path_util.AddDirToPathIfNeeded(gpu_path_util.CHROMIUM_SRC_DIR, 'build')
diff --git a/content/test/gpu/gpu_tests/skia_gold/gpu_skia_gold_session_manager.py b/content/test/gpu/gpu_tests/skia_gold/gpu_skia_gold_session_manager.py
deleted file mode 100644
index 080402d..0000000
--- a/content/test/gpu/gpu_tests/skia_gold/gpu_skia_gold_session_manager.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright 2020 The Chromium Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-"""GPU impl of //testing/skia_gold_common/skia_gold_session_manager.py."""
-
-from skia_gold_common import output_managerless_skia_gold_session
-from skia_gold_common import skia_gold_session_manager as sgsm
-
-
-class GpuSkiaGoldSessionManager(sgsm.SkiaGoldSessionManager):
-  @staticmethod
-  def GetSessionClass():
-    return output_managerless_skia_gold_session.OutputManagerlessSkiaGoldSession
diff --git a/content/test/gpu/gpu_tests/skia_gold_integration_test_base.py b/content/test/gpu/gpu_tests/skia_gold_integration_test_base.py
index 2567ec47..8d26f07 100644
--- a/content/test/gpu/gpu_tests/skia_gold_integration_test_base.py
+++ b/content/test/gpu/gpu_tests/skia_gold_integration_test_base.py
@@ -18,10 +18,10 @@
 from gpu_tests import gpu_helper
 from gpu_tests import gpu_integration_test
 from gpu_tests import pixel_test_pages
-from gpu_tests.skia_gold import gpu_skia_gold_session_manager as sgsm
 
 from skia_gold_common import skia_gold_properties as sgp
 from skia_gold_common import skia_gold_session as sgs
+from skia_gold_common import skia_gold_session_manager as sgsm
 
 import gpu_path_util
 
@@ -83,9 +83,9 @@
     return cls._skia_gold_properties
 
   @classmethod
-  def GetSkiaGoldSessionManager(cls) -> sgsm.GpuSkiaGoldSessionManager:
+  def GetSkiaGoldSessionManager(cls) -> sgsm.SkiaGoldSessionManager:
     if not cls._skia_gold_session_manager:
-      cls._skia_gold_session_manager = sgsm.GpuSkiaGoldSessionManager(
+      cls._skia_gold_session_manager = sgsm.SkiaGoldSessionManager(
           cls._skia_gold_temp_dir, cls.GetSkiaGoldProperties())
     return cls._skia_gold_session_manager
 
diff --git a/testing/scripts/run_finch_smoke_tests_android.py b/testing/scripts/run_finch_smoke_tests_android.py
index f3f2f621..1437b50 100755
--- a/testing/scripts/run_finch_smoke_tests_android.py
+++ b/testing/scripts/run_finch_smoke_tests_android.py
@@ -78,7 +78,7 @@
 from py_utils.tempfile_ext import NamedTemporaryDirectory
 from scripts import common
 from skia_gold_common.skia_gold_properties import SkiaGoldProperties
-from skia_gold_infra import finch_skia_gold_session_manager
+from skia_gold_common import skia_gold_session_manager
 from skia_gold_infra import finch_skia_gold_utils
 from run_wpt_tests import get_device
 
@@ -334,7 +334,7 @@
     self._device.adb.Emu(['power', 'ac', 'on'])
     self._skia_gold_tmp_dir = tempfile.mkdtemp()
     self._skia_gold_session_manager = (
-        finch_skia_gold_session_manager.FinchSkiaGoldSessionManager(
+        skia_gold_session_manager.SkiaGoldSessionManager(
             self._skia_gold_tmp_dir, SkiaGoldProperties(self.options)))
     return self
 
diff --git a/testing/scripts/skia_gold_infra/finch_skia_gold_session_manager.py b/testing/scripts/skia_gold_infra/finch_skia_gold_session_manager.py
deleted file mode 100644
index f9b15a7..0000000
--- a/testing/scripts/skia_gold_infra/finch_skia_gold_session_manager.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2022 The Chromium Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-"""Finch impl of skia_gold_session_manager.py."""
-
-import os
-import sys
-
-THIS_DIR = os.path.abspath(os.path.dirname(__file__))
-CHROMIUM_SRC_DIR = os.path.realpath(os.path.join(THIS_DIR, '..', '..', '..'))
-sys.path.insert(0, os.path.join(CHROMIUM_SRC_DIR, 'build'))
-from skia_gold_common import output_managerless_skia_gold_session
-from skia_gold_common import skia_gold_session_manager as sgsm
-
-
-class FinchSkiaGoldSessionManager(sgsm.SkiaGoldSessionManager):
-  @staticmethod
-  def GetSessionClass():
-    return output_managerless_skia_gold_session.OutputManagerlessSkiaGoldSession
diff --git a/testing/scripts/skia_gold_infra/finch_skia_gold_utils.py b/testing/scripts/skia_gold_infra/finch_skia_gold_utils.py
index bd172c8..5e96a89 100644
--- a/testing/scripts/skia_gold_infra/finch_skia_gold_utils.py
+++ b/testing/scripts/skia_gold_infra/finch_skia_gold_utils.py
@@ -4,9 +4,9 @@
 
 import logging
 import sys
-from .finch_skia_gold_session_manager import FinchSkiaGoldSessionManager
 
 from skia_gold_common.skia_gold_properties import SkiaGoldProperties
+from skia_gold_common.skia_gold_session_manager import SkiaGoldSessionManager
 
 # This is the corpus used by skia gold to identify the data set.
 # We are not using the same corpus as the rest of the skia gold chromium tests.
@@ -17,7 +17,7 @@
 class FinchSkiaGoldUtil:
   def __init__(self, temp_dir, args):
     self._skia_gold_properties = SkiaGoldProperties(args)
-    self._skia_gold_session_manager = FinchSkiaGoldSessionManager(
+    self._skia_gold_session_manager = SkiaGoldSessionManager(
         temp_dir, self._skia_gold_properties)
     self._skia_gold_session = self._GetSkiaGoldSession()
     self._retry_without_patch = False