# Path: android_env/components/adb_log_stream.py
# _LOGCAT_COMMAND = ['logcat', '-v', 'epoch']
# class AdbLogStream(log_stream.LogStream):
#   def __init__(self, adb_command_prefix: List[str], *args, **kwargs):
#   def _get_stream_output(self):
#   def stop_stream(self):


import subprocess
import mock
from absl.testing import absltest
from android_env.components import adb_log_stream
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for adb_log_stream."""




class FakeAdbSubprocess():

  @property
  def stdout(self):
    return [f'line_{i}' for i in range(100)]

  def kill(self):
    pass


class AdbLogStreamTest(absltest.TestCase):

  @mock.patch.object(subprocess, 'Popen', return_value=FakeAdbSubprocess())
  def test_get_stream_output(self, mock_popen):

# Path: android_env/components/adb_log_stream.py
# _LOGCAT_COMMAND = ['logcat', '-v', 'epoch']
# class AdbLogStream(log_stream.LogStream):
#   def __init__(self, adb_command_prefix: List[str], *args, **kwargs):
#   def _get_stream_output(self):
#   def stop_stream(self):


# Path: android_env/components/adb_log_stream_test.py
import subprocess
import mock
from absl.testing import absltest
from android_env.components import adb_log_stream

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for adb_log_stream."""




class FakeAdbSubprocess():

  @property
  def stdout(self):
    return [f'line_{i}' for i in range(100)]

  def kill(self):
    pass


class AdbLogStreamTest(absltest.TestCase):

  @mock.patch.object(subprocess, 'Popen', return_value=FakeAdbSubprocess())
  def test_get_stream_output(self, mock_popen):

    stream = adb_log_stream.AdbLogStream(adb_command_prefix=['foo'])