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

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

Issue 749353003: [chromedriver] Fix mobile device embedding script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
Index: chrome/test/chromedriver/cpp_source.py
diff --git a/chrome/test/chromedriver/cpp_source.py b/chrome/test/chromedriver/cpp_source.py
index 498fd2549ab88cac0ca19f8c96ce8dfe76e98093..be8697da841d028e3fa28f53ee73ae9641f4dff7 100644
--- a/chrome/test/chromedriver/cpp_source.py
+++ b/chrome/test/chromedriver/cpp_source.py
@@ -7,6 +7,9 @@
import datetime
import os
+# 80-character max line length, minus 4 spaces, and 2 quotations.
+MAX_LINE_LEN = 74
+
def WriteSource(base_name,
dir_from_src,
@@ -57,7 +60,17 @@ def WriteSource(base_name,
for name, contents in global_string_map.iteritems():
lines = []
if '\n' not in contents:
- lines = [' "%s"' % EscapeLine(contents)]
+
+ contents = EscapeLine(contents)
+ while len(contents) > MAX_LINE_LEN:
+ if contents[MAX_LINE_LEN-1] == '\\':
+ lines.append(' "%s"' % contents[:MAX_LINE_LEN-1])
+ contents = contents[MAX_LINE_LEN-1:]
+ else:
+ lines.append(' "%s"' % contents[:MAX_LINE_LEN])
+ contents = contents[MAX_LINE_LEN:]
+
+ lines.append(' "%s"' % contents)
samuong 2014/12/11 00:22:19 Maybe an easier way to do this is to just pump eve
srawlins 2014/12/12 23:41:29 Done.
else:
for line in contents.split('\n'):
lines += [' "%s\\n"' % EscapeLine(line)]
« no previous file with comments | « chrome/test/chromedriver/chrome/mobile_device_list.cc ('k') | chrome/test/chromedriver/embed_mobile_devices_in_cpp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698