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

Unified Diff: build/android/pylib/base/remote_device_config.py

Issue 745793002: Add AMP support to test runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
Index: build/android/pylib/base/remote_device_config.py
diff --git a/build/android/pylib/base/remote_device_config.py b/build/android/pylib/base/remote_device_config.py
new file mode 100644
index 0000000000000000000000000000000000000000..44b9e0b255c8ad90fee33d02da2325a2abbe9491
--- /dev/null
+++ b/build/android/pylib/base/remote_device_config.py
@@ -0,0 +1,58 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
jbudorick 2014/11/21 00:17:24 These three remote_device_* files should be in bui
rnephew (Reviews Here) 2014/11/21 18:26:46 Done.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Creates test config files for remote devices."""
+
+import os
+
+
+class RemoteDeviceConfig(object):
+
+ """Config file object used with remote device tests."""
+
+ def __init__(self, test_type, app, extras=None,
+ config_path='/tmp/remote_device_temp.config'):
+ self._config_path = config_path
+ self._test_type = test_type
+ self._extras = extras
+ self._app = app
+
+ def __enter__(self):
+ self.GenerateTestConfig()
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ os.remove(self._config_path)
+
+ def GenerateTestConfig(self):
+
+ """Uses test_type and extras dict to create config file."""
+
+ config_data = []
+ config_data.append('[appurify]')
+ if self._test_type == 'gtest':
+ config_data.append('[robotium]')
jbudorick 2014/11/21 00:17:24 This should probably be configurable.
rnephew (Reviews Here) 2014/11/21 18:26:46 Added to do for this. Will do before landing CL. (
rnephew (Reviews Here) 2014/11/21 22:37:01 Done in the latest patch set. Still a lot of room
+ config_data.append('runner=org.chromium.native_test.'
jbudorick 2014/11/21 00:17:24 This will need to be configurable.
rnephew (Reviews Here) 2014/11/21 18:26:47 Same.
+ 'ChromiumNativeTestInstrumentationTestRunner')
+ elif self._test_type == 'uiautomator':
+ config_data.append('[android_uiautomator]')
+ raise NotImplementedError
+ elif self._test_type == 'uirobot':
+ if self._app.endswith('.apk'):
jbudorick 2014/11/21 00:17:24 1. Don't add support for iOS yet. 2. When we do ad
rnephew (Reviews Here) 2014/11/21 18:26:47 Removed.
+ config_data.append('[android_robot]')
+ elif self._app.endswith('.ipa'):
+ config_data.append('[ios_robot]')
+ else:
+ raise NotImplementedError
+ if self._extras:
+ for key in self._extras:
jbudorick 2014/11/21 00:17:24 config_data.extend('%s=%s' % (k, v) for k, v in se
rnephew (Reviews Here) 2014/11/21 18:26:47 Done.
+ entry = key + '=' + self._extras[key]
+ config_data.append(entry)
+ with open(self._config_path, 'w') as config_file:
+ for line in config_data:
jbudorick 2014/11/21 00:17:24 config_file.write('%s\n' % line for line in config
rnephew (Reviews Here) 2014/11/21 18:26:46 That didn't work but I switched to using writeline
+ config_file.write(line + '\n')
+
+ @property
+ def path(self):
+ return self._config_path

Powered by Google App Engine
This is Rietveld 408576698