[Android] Clear application state on instrumentation test failure.

Some (still-unidentified) instrumentation tests leave an account on the
device, causing subsequent uses of the device to fail the DCHECK here:
https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/signin/oauth2_token_service_delegate_android.cc&l=552

Clearing the application state on failure should return the device to
a viable state.

This CL _does not_ resolve the underlying flake, but it does further
mitigate its impact while I keep looking for it.

BUG=533188
TBR=mikecase@chromium.org

Review URL: https://codereview.chromium.org/1407613004

Cr-Original-Commit-Position: refs/heads/master@{#353964}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 150d81724c609b042dffacf1e770945b81673ac7
This commit is contained in:
jbudorick 2015-10-13 22:56:02 -07:00 коммит произвёл Commit bot
Родитель a749a30fb9
Коммит 106d24dbf5
2 изменённых файлов: 14 добавлений и 11 удалений

Просмотреть файл

@ -196,20 +196,21 @@ class TestRunner(base_test_runner.BaseTestRunner):
self.tool.CleanUpEnvironment()
# The logic below relies on the test passing.
if not result or not result.DidRunPass():
if not result:
return
if result.DidRunPass():
self.TearDownPerfMonitoring(test)
self.TearDownPerfMonitoring(test)
if self.flags and self._IsFreTest(test):
self.flags.AddFlags(['--disable-fre'])
if self.flags and self._IsFreTest(test):
self.flags.AddFlags(['--disable-fre'])
if self.coverage_dir:
self.device.PullFile(
self.coverage_device_file, self.coverage_host_file)
self.device.RunShellCommand(
'rm -f %s' % self.coverage_device_file)
if self.coverage_dir:
self.device.PullFile(
self.coverage_device_file, self.coverage_host_file)
self.device.RunShellCommand(
'rm -f %s' % self.coverage_device_file)
elif self.package_info:
self.device.ClearApplicationState(self.package_info.package)
def TearDownPerfMonitoring(self, test):
"""Cleans up performance monitoring if the specified test required it.

Просмотреть файл

@ -167,6 +167,8 @@ class LocalDeviceInstrumentationTestRun(
for r in results:
if r.GetType() == base_test_result.ResultType.UNKNOWN:
r.SetType(base_test_result.ResultType.CRASH)
# TODO(jbudorick): ClearApplicationState on failure before switching
# instrumentation tests to platform mode.
return results
#override