Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / chromedriver / embed_user_data_dir_in_cpp.py
blob46b32f5e560e77dc7d248973197b5375a051aa30
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
6 """Embeds Chrome user data files in C++ code."""
8 import optparse
9 import os
10 import sys
12 import cpp_source
15 def main():
16 parser = optparse.OptionParser()
17 parser.add_option(
18 '', '--directory', type='string', default='.',
19 help='Path to directory where the cc/h file should be created')
20 options, args = parser.parse_args()
22 global_string_map = {}
23 for data_file in args:
24 title = os.path.basename(os.path.splitext(data_file)[0]).title()
25 var_name = 'k' + title.replace('_', '')
26 with open(data_file, 'r') as f:
27 contents = f.read()
28 global_string_map[var_name] = contents
30 cpp_source.WriteSource('user_data_dir', 'chrome/test/chromedriver/chrome',
31 options.directory, global_string_map)
34 if __name__ == '__main__':
35 sys.exit(main())