1# Copyright 2015 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import os
6import shutil
7import tempfile
8
9from telemetry import decorators
10from telemetry.internal.platform.profiler import (
11    android_screen_recorder_profiler)
12from telemetry.testing import tab_test_case
13
14
15class AndroidScreenRecorderProfilerTest(tab_test_case.TabTestCase):
16  @decorators.Enabled('android')
17  def testRecording(self):
18    out_dir = tempfile.mkdtemp()
19    try:
20      # pylint: disable=protected-access
21      profiler = (
22          android_screen_recorder_profiler.AndroidScreenRecordingProfiler(
23              self._browser._browser_backend,
24              self._browser._platform_backend,
25              os.path.join(out_dir, 'android_screen_recording'),
26              {}))
27      result = profiler.CollectProfile()[0]
28      self.assertTrue(os.path.exists(result))
29    finally:
30      shutil.rmtree(out_dir)
31