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

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

Issue 12848005: [chromedriver] Separate stuff of chrome from chromedriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments and fix compile error on mac. Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/chromedriver/embed_js_in_cpp.py ('k') | chrome/test/chromedriver/frame_tracker.h » ('j') | 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 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 Chrome user data files in C++ code.""" 6 """Embeds Chrome user data files in C++ code."""
7 7
8 import optparse 8 import optparse
9 import os 9 import os
10 import sys 10 import sys
11 11
12 import cpp_source 12 import cpp_source
13 13
14 14
15 def main(): 15 def main():
16 parser = optparse.OptionParser() 16 parser = optparse.OptionParser()
17 parser.add_option( 17 parser.add_option(
18 '', '--directory', type='string', default='.', 18 '', '--directory', type='string', default='.',
19 help='Path to directory where the cc/h file should be created') 19 help='Path to directory where the cc/h file should be created')
20 options, args = parser.parse_args() 20 options, args = parser.parse_args()
21 21
22 global_string_map = {} 22 global_string_map = {}
23 for data_file in args: 23 for data_file in args:
24 title = os.path.basename(os.path.splitext(data_file)[0]).title() 24 title = os.path.basename(os.path.splitext(data_file)[0]).title()
25 var_name = 'k' + title.replace('_', '') 25 var_name = 'k' + title.replace('_', '')
26 with open(data_file, 'r') as f: 26 with open(data_file, 'r') as f:
27 contents = f.read() 27 contents = f.read()
28 global_string_map[var_name] = contents 28 global_string_map[var_name] = contents
29 29
30 cpp_source.WriteSource('user_data_dir', 'chrome/test/chromedriver', 30 cpp_source.WriteSource('user_data_dir', 'chrome/test/chromedriver/chrome',
31 options.directory, global_string_map) 31 options.directory, global_string_map)
32 32
33 33
34 if __name__ == '__main__': 34 if __name__ == '__main__':
35 sys.exit(main()) 35 sys.exit(main())
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/embed_js_in_cpp.py ('k') | chrome/test/chromedriver/frame_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698