Commit 390e5e8e authored by rbpotter's avatar rbpotter Committed by Commit Bot

Grit: Fix chrome_scaled_image_unittest

Fix 3 test failures on Windows.

Note: Manually tested on both Linux and Windows, since grit tests do
not run on the trybots.

Bug: 961359
Change-Id: I69ee6933b570795e3d963317f2b326fbfb6c0322
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1605158Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659669}
parent cec94e23
......@@ -60,7 +60,7 @@ def _GetFilesInRc(rcname, tmp_dir, contents):
'''
data = util.ReadFile(rcname, util.BINARY).decode('utf-16')
contents = dict((tmp_dir.GetPath(k), v) for k, v in contents.items())
return set(contents[m.group(1)]
return set(contents[os.path.normpath(m.group(1))]
for m in re.finditer(ur'(?m)^\w+\s+BINDATA\s+"([^"]+)"$', data))
......@@ -105,7 +105,8 @@ def _RunBuildTest(self, structures, inputs, expected_outputs, skip_rc=False,
''' % (outputs, structures),
}
for pngpath, pngdata in inputs.items():
infiles['in/' + pngpath] = pngdata
normpath = os.path.normpath('in/' + pngpath)
infiles[normpath] = pngdata
class Options(object):
pass
with util.TempDir(infiles) as tmp_dir:
......
......@@ -641,7 +641,7 @@ class TempDir(object):
dir_path = os.path.split(file_path)[0]
if not os.path.exists(dir_path):
os.makedirs(dir_path)
with open(file_path, 'w') as f:
with open(file_path, 'wb') as f:
f.write(file_data[name])
def __enter__(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment