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."""
19 parser
= optparse
.OptionParser()
21 '', '--directory', type='string', default
='.',
22 help='Path to directory where the cc/h file should be created')
23 options
, args
= parser
.parse_args()
25 global_string_map
= {}
26 string_buffer
= StringIO
.StringIO()
27 zipper
= zipfile
.ZipFile(string_buffer
, 'w')
29 zipper
.write(f
, os
.path
.basename(f
), zipfile
.ZIP_STORED
)
31 global_string_map
['kAutomationExtension'] = base64
.b64encode(
32 string_buffer
.getvalue())
35 cpp_source
.WriteSource('embedded_automation_extension',
36 'chrome/test/chromedriver/chrome',
37 options
.directory
, global_string_map
)
40 if __name__
== '__main__':