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

Unified Diff: tools/telemetry/telemetry/android_browser_backend.py

Issue 11574039: Telemetry: start the activity in order to initialize the prefs file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased again Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/android_browser_backend.py
diff --git a/tools/telemetry/telemetry/android_browser_backend.py b/tools/telemetry/telemetry/android_browser_backend.py
index 07c26cac235e47f6f831c5b507d492cc004f176a..1d1e0c4ca9f84475acb8134367dc65a5b025c9ba 100644
--- a/tools/telemetry/telemetry/android_browser_backend.py
+++ b/tools/telemetry/telemetry/android_browser_backend.py
@@ -1,12 +1,14 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
import json
import logging
import os
import subprocess
import sys
import tempfile
+import time
from telemetry import adb_commands
from telemetry import browser_backend
@@ -72,11 +74,23 @@ class AndroidBrowserBackend(browser_backend.BrowserBackend):
prefs_file = (app_data_dir +
'/app_chrome/Default/Preferences')
if not self._adb.FileExistsOnDevice(prefs_file):
- logging.critical(
- 'android_browser_backend: Could not find preferences file ' +
- '%s for %s' % (prefs_file, self._package))
- raise browser_gone_exception.BrowserGoneException(
- 'Missing preferences file.')
+ # Start it up the first time so we can tweak the prefs.
+ self._adb.StartActivity(self._package,
+ self._activity,
+ True,
+ None,
+ None)
+ retries = 0
+ while not self._adb.Adb().GetFileContents(prefs_file):
+ time.sleep(3)
+ retries += 1
+ if retries == 3:
+ logging.critical('android_browser_backend: Could not find '
+ 'preferences file %s for %s',
+ prefs_file, self._package)
+ raise browser_gone_exception.BrowserGoneException(
+ 'Missing preferences file.')
+ self._adb.KillAll(self._package)
with tempfile.NamedTemporaryFile() as raw_f:
self._adb.Pull(prefs_file, raw_f.name)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698