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

Side by Side Diff: chrome/test/chromedriver/embed_mobile_devices_in_cpp.py

Issue 302273003: [ChromeDriver] Fix embed mobilde devices script for new Blink roll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « chrome/test/chromedriver/capabilities_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Embeds standalone JavaScript snippets in C++ code. 6 """Embeds standalone JavaScript snippets in C++ code.
7 7
8 The script requires the OverridesView file from WebKit that lists the known 8 The script requires the OverridesView file from WebKit that lists the known
9 mobile devices to be passed in as the only argument. The list of known devices 9 mobile devices to be passed in as the only argument. The list of known devices
10 will be written to a C-style string to be parsed with JSONReader. 10 will be written to a C-style string to be parsed with JSONReader.
(...skipping 12 matching lines...) Expand all
23 '', '--directory', type='string', default='.', 23 '', '--directory', type='string', default='.',
24 help='Path to directory where the cc/h files should be created') 24 help='Path to directory where the cc/h files should be created')
25 options, args = parser.parse_args() 25 options, args = parser.parse_args()
26 26
27 devices = '[' 27 devices = '['
28 file_name = args[0] 28 file_name = args[0]
29 inside_list = False 29 inside_list = False
30 with open(file_name, 'r') as f: 30 with open(file_name, 'r') as f:
31 for line in f: 31 for line in f:
32 if not inside_list: 32 if not inside_list:
33 if 'DeviceTab._phones = [' in line or 'DeviceTab._tablets = [' in line: 33 if 'WebInspector.OverridesSupport._phones = [' in line or \
34 'WebInspector.OverridesSupport._tablets = [' in line:
34 inside_list = True 35 inside_list = True
35 else: 36 else:
36 if line.strip() == '];': 37 if line.strip() == '];':
37 inside_list = False 38 inside_list = False
38 continue 39 continue
39 devices += line.strip() 40 devices += line.strip()
40 41
41 devices += ']' 42 devices += ']'
42 cpp_source.WriteSource('mobile_device_list', 43 cpp_source.WriteSource('mobile_device_list',
43 'chrome/test/chromedriver/chrome', 44 'chrome/test/chromedriver/chrome',
44 options.directory, {'kMobileDevices': devices}) 45 options.directory, {'kMobileDevices': devices})
45 46
46 47
47 if __name__ == '__main__': 48 if __name__ == '__main__':
48 sys.exit(main()) 49 sys.exit(main())
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/capabilities_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698