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

Unified Diff: chrome/test/chromedriver/embed_mobile_devices_in_cpp.py

Issue 251933005: [ChromeDriver] Support mobile emulation on desktop Chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix implicit bool conversion warning Created 6 years, 7 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 | « chrome/test/chromedriver/client/webelement.py ('k') | chrome/test/chromedriver/session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/embed_mobile_devices_in_cpp.py
diff --git a/chrome/test/chromedriver/embed_mobile_devices_in_cpp.py b/chrome/test/chromedriver/embed_mobile_devices_in_cpp.py
new file mode 100755
index 0000000000000000000000000000000000000000..6cb380676d8cddbbb10b2ec6151a38a2400f32d5
--- /dev/null
+++ b/chrome/test/chromedriver/embed_mobile_devices_in_cpp.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# Copyright (c) 2014 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.
+
+"""Embeds standalone JavaScript snippets in C++ code.
+
+The script requires the OverridesView file from WebKit that lists the known
+mobile devices to be passed in as the only argument. The list of known devices
+will be written to a C-style string to be parsed with JSONReader.
+"""
+
+import optparse
+import os
+import sys
+
+import cpp_source
+
+
+def main():
+ parser = optparse.OptionParser()
+ parser.add_option(
+ '', '--directory', type='string', default='.',
+ help='Path to directory where the cc/h files should be created')
+ options, args = parser.parse_args()
+
+ devices = '['
+ file_name = args[0]
+ inside_list = False
+ with open(file_name, 'r') as f:
+ for line in f:
+ if not inside_list:
+ if 'DeviceTab._phones = [' in line or 'DeviceTab._tablets = [' in line:
+ inside_list = True
+ else:
+ if line.strip() == '];':
+ inside_list = False
+ continue
+ devices += line.strip()
+
+ devices += ']'
+ cpp_source.WriteSource('mobile_device_list',
+ 'chrome/test/chromedriver/chrome',
+ options.directory, {'kMobileDevices': devices})
+
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « chrome/test/chromedriver/client/webelement.py ('k') | chrome/test/chromedriver/session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698