Index: tools/telemetry/telemetry/core/platform/profiler/android_profiling_helper_unittest.py |
diff --git a/tools/telemetry/telemetry/core/platform/profiler/android_profiling_helper_unittest.py b/tools/telemetry/telemetry/core/platform/profiler/android_profiling_helper_unittest.py |
index c75176221e25a38f9bafed8e9124cda85382532d..5a23dbb92a84892d6c9a0f15527b7347d94991d7 100644 |
--- a/tools/telemetry/telemetry/core/platform/profiler/android_profiling_helper_unittest.py |
+++ b/tools/telemetry/telemetry/core/platform/profiler/android_profiling_helper_unittest.py |
@@ -3,6 +3,7 @@ |
# found in the LICENSE file. |
import glob |
import os |
+import pickle |
import re |
import shutil |
import tempfile |
@@ -63,6 +64,37 @@ class TestAndroidProfilingHelper(tab_test_case.TabTestCase): |
android_profiling_helper.subprocess = real_subprocess |
@test.Enabled('android') |
+ def testGetRequiredLibrariesForVTuneProfile(self): |
+ vtune_db_output = os.path.join( |
+ util.GetUnittestDataDir(), 'sample_vtune_db_output') |
+ with open(vtune_db_output, 'rb') as f: |
+ vtune_db_output = pickle.load(f) |
+ |
+ mock_cursor = simple_mock.MockObject() |
+ mock_cursor.ExpectCall( |
+ 'execute').WithArgs(simple_mock.DONT_CARE).WillReturn(vtune_db_output) |
+ |
+ mock_conn = simple_mock.MockObject() |
+ mock_conn.ExpectCall('cursor').WillReturn(mock_cursor) |
+ mock_conn.ExpectCall('close') |
+ |
+ mock_sqlite3 = simple_mock.MockObject() |
+ mock_sqlite3.ExpectCall( |
+ 'connect').WithArgs(simple_mock.DONT_CARE).WillReturn(mock_conn) |
+ |
+ real_sqlite3 = android_profiling_helper.sqlite3 |
+ android_profiling_helper.sqlite3 = mock_sqlite3 |
+ try: |
+ libs = android_profiling_helper.GetRequiredLibrariesForVTuneProfile('foo') |
+ self.assertEqual(libs, set([ |
+ '/data/app-lib/com.google.android.apps.chrome-1/libchrome.2019.0.so', |
+ '/system/lib/libdvm.so', |
+ '/system/lib/libc.so', |
+ '/system/lib/libm.so'])) |
+ finally: |
+ android_profiling_helper.sqlite3 = real_sqlite3 |
+ |
+ @test.Enabled('android') |
def testCreateSymFs(self): |
# pylint: disable=W0212 |
browser_pid = self._browser._browser_backend.pid |