Refactoring: Move mime type calculations closer to the point of 1st use.
This CL moves the call to canonical_mime_type_ = network::CrossOriginReadBlocking::GetCanonicalMimeType(mime_type); closer to the point where the value of the |canonical_mime_type_| field is needed for the 1st time. The move helps with the following: - Makes unit tests more robust against shuffling of chucks inside ShouldBlockBasedOnHeaders (some shuffling will be needed when moving some checks into //services/network). - Makes the code of ShouldBlockBasedOnHeaders closer to the promise to perform less expensive checks first (the GetCanonicalMimeType has medium cost - it has to compare the mime type against multiple hardcoded strings). The move necessitates some small follow-up tweaks in unit tests. Bug: 792546 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo Change-Id: Ib21add69443dd0748aafd57da89a3cc16ffcdec1 Reviewed-on: https://chromium-review.googlesource.com/957804Reviewed-by:Nick Carter <nick@chromium.org> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/master@{#542643}
Showing
Please register or sign in to comment