Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: build/android/pylib/gtest/gtest_test_instance.py

Issue 1165623003: [Android] Allow gtests to pull app data off the device before clearing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 import re 7 import re
8 import shutil 8 import shutil
9 import sys 9 import sys
10 import tempfile
10 11
11 from pylib import constants 12 from pylib import constants
12 from pylib.base import base_test_result 13 from pylib.base import base_test_result
13 from pylib.base import test_instance 14 from pylib.base import test_instance
14 15
15 sys.path.append(os.path.join( 16 sys.path.append(os.path.join(
16 constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common')) 17 constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common'))
17 import unittest_util 18 import unittest_util
18 19
19 20
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 self._gtest_filter = None 121 self._gtest_filter = None
121 if args.isolate_file_path: 122 if args.isolate_file_path:
122 self._isolate_abs_path = os.path.abspath(args.isolate_file_path) 123 self._isolate_abs_path = os.path.abspath(args.isolate_file_path)
123 self._isolate_delegate = isolate_delegate 124 self._isolate_delegate = isolate_delegate
124 self._isolated_abs_path = os.path.join( 125 self._isolated_abs_path = os.path.join(
125 constants.GetOutDirectory(), '%s.isolated' % self._suite) 126 constants.GetOutDirectory(), '%s.isolated' % self._suite)
126 else: 127 else:
127 logging.warning('No isolate file provided. No data deps will be pushed.'); 128 logging.warning('No isolate file provided. No data deps will be pushed.');
128 self._isolate_delegate = None 129 self._isolate_delegate = None
129 130
131 if args.app_data_files:
132 self._app_data_files = args.app_data_files
133 if args.app_data_file_dir:
134 self._app_data_file_dir = args.app_data_file_dir
135 else:
136 self._app_data_file_dir = tempfile.mkdtemp()
137 logging.critical('Saving app files to %s', self._app_data_file_dir)
138 else:
139 self._app_data_files = None
140 self._app_data_file_dir = None
141
130 #override 142 #override
131 def TestType(self): 143 def TestType(self):
132 return 'gtest' 144 return 'gtest'
133 145
134 #override 146 #override
135 def SetUp(self): 147 def SetUp(self):
136 """Map data dependencies via isolate.""" 148 """Map data dependencies via isolate."""
137 if self._isolate_delegate: 149 if self._isolate_delegate:
138 self._isolate_delegate.Remap( 150 self._isolate_delegate.Remap(
139 self._isolate_abs_path, self._isolated_abs_path) 151 self._isolate_abs_path, self._isolated_abs_path)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 def TearDown(self): 237 def TearDown(self):
226 """Clear the mappings created by SetUp.""" 238 """Clear the mappings created by SetUp."""
227 if self._isolate_delegate: 239 if self._isolate_delegate:
228 self._isolate_delegate.Clear() 240 self._isolate_delegate.Clear()
229 241
230 @property 242 @property
231 def apk(self): 243 def apk(self):
232 return self._apk_path 244 return self._apk_path
233 245
234 @property 246 @property
247 def app_file_dir(self):
248 return self._app_data_file_dir
249
250 @property
251 def app_files(self):
252 return self._app_data_files
253
254 @property
235 def exe(self): 255 def exe(self):
236 return self._exe_path 256 return self._exe_path
237 257
238 @property 258 @property
239 def suite(self): 259 def suite(self):
240 return self._suite 260 return self._suite
241 261
OLDNEW
« no previous file with comments | « build/android/pylib/device/device_utils_test.py ('k') | build/android/pylib/gtest/local_device_gtest_run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698