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

Side by Side Diff: build/android/pylib/linker/test_case.py

Issue 338353004: [Android] Switch KillAll, StartActivity, and BroadcastIntent to DeviceUtils. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: appeasing windows Created 6 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """Base class for linker-specific test cases. 5 """Base class for linker-specific test cases.
6 6
7 The custom dynamic linker can only be tested through a custom test case 7 The custom dynamic linker can only be tested through a custom test case
8 for various technical reasons: 8 for various technical reasons:
9 9
10 - It's an 'invisible feature', i.e. it doesn't expose a new API or 10 - It's an 'invisible feature', i.e. it doesn't expose a new API or
(...skipping 24 matching lines...) Expand all
35 """ 35 """
36 # pylint: disable=R0201 36 # pylint: disable=R0201
37 37
38 import logging 38 import logging
39 import os 39 import os
40 import re 40 import re
41 import time 41 import time
42 42
43 from pylib import constants 43 from pylib import constants
44 from pylib.base import base_test_result 44 from pylib.base import base_test_result
45 from pylib.device import intent
45 46
46 47
47 ResultType = base_test_result.ResultType 48 ResultType = base_test_result.ResultType
48 49
49 _PACKAGE_NAME = 'org.chromium.chromium_linker_test_apk' 50 _PACKAGE_NAME = 'org.chromium.chromium_linker_test_apk'
50 _ACTIVITY_NAME = '.ChromiumLinkerTestActivity' 51 _ACTIVITY_NAME = '.ChromiumLinkerTestActivity'
51 _COMMAND_LINE_FILE = '/data/local/tmp/chromium-linker-test-command-line' 52 _COMMAND_LINE_FILE = '/data/local/tmp/chromium-linker-test-command-line'
52 53
53 # Path to the Linker.java source file. 54 # Path to the Linker.java source file.
54 _LINKER_JAVA_SOURCE_PATH = ( 55 _LINKER_JAVA_SOURCE_PATH = (
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 Returns: 158 Returns:
158 A (status, logs) tuple, where status is a ResultType constant, and logs 159 A (status, logs) tuple, where status is a ResultType constant, and logs
159 if the final logcat output as a string. 160 if the final logcat output as a string.
160 """ 161 """
161 # 1. Start recording logcat with appropriate filters. 162 # 1. Start recording logcat with appropriate filters.
162 device.old_interface.StartRecordingLogcat( 163 device.old_interface.StartRecordingLogcat(
163 clear=True, filters=_LOGCAT_FILTERS) 164 clear=True, filters=_LOGCAT_FILTERS)
164 165
165 try: 166 try:
166 # 2. Force-start activity. 167 # 2. Force-start activity.
167 device.old_interface.StartActivity( 168 device.StartActivity(
168 package=_PACKAGE_NAME, activity=_ACTIVITY_NAME, force_stop=True) 169 intent.Intent(package=_PACKAGE_NAME, activity=_ACTIVITY_NAME),
170 force_stop=True)
169 171
170 # 3. Wait up to |timeout| seconds until the test status is in the logcat. 172 # 3. Wait up to |timeout| seconds until the test status is in the logcat.
171 num_tries = 0 173 num_tries = 0
172 max_tries = timeout 174 max_tries = timeout
173 found = False 175 found = False
174 while num_tries < max_tries: 176 while num_tries < max_tries:
175 time.sleep(1) 177 time.sleep(1)
176 num_tries += 1 178 num_tries += 1
177 found, browser_ok, renderer_ok = _CheckLinkerTestStatus( 179 found, browser_ok, renderer_ok = _CheckLinkerTestStatus(
178 device.old_interface.GetCurrentRecordedLogcat()) 180 device.old_interface.GetCurrentRecordedLogcat())
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 # Note that this behaviour doesn't seem to happen when starting an 533 # Note that this behaviour doesn't seem to happen when starting an
532 # application 'normally', i.e. when using the application launcher to 534 # application 'normally', i.e. when using the application launcher to
533 # start the activity. 535 # start the activity.
534 logging.info('Ignoring system\'s low randomization of browser libraries' + 536 logging.info('Ignoring system\'s low randomization of browser libraries' +
535 ' for regular devices') 537 ' for regular devices')
536 538
537 if not renderer_status: 539 if not renderer_status:
538 return ResultType.FAIL, renderer_logs 540 return ResultType.FAIL, renderer_logs
539 541
540 return ResultType.PASS, logs 542 return ResultType.PASS, logs
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/test_package_exe.py ('k') | build/android/pylib/monkey/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698