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

Issue 2864253003: Split ImageLoader::SetImage() and set flags consistently in tests (Closed)

Created:
3 years, 7 months ago by hiroshige
Modified:
3 years, 7 months ago
CC:
blink-reviews, blink-reviews-frames_chromium.org, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Split ImageLoader::SetImage() and set flags consistently in tests Previously, ImageLoader::SetImage() is used in three ways: 1. SetImage(nullptr), 2. SetImage(non-null) for ImageDocument, and 3. SetImage(non-null) for unit tests for non-ImageDocument. and SetImage() sets has_pending_load_event_ = false and image_complete_ = true for all of these. This flag setting is consistent for 1., but not for 3., and causes assertion failures when we apply stronger assertions in [1]. This CL fixes this by splitting SetImage() for separate methods: 1. ClearImage(), 2. SetImageForImageDocument(), and 3. SetImageForTest(), and introducing UpdateImageState() that sets: - image_ - has_pending_load_event_ - image_complete_ This CL - Doesn't change non-test behavior, i.e. keeps the behavior for Cases 1 and 2. Particularly, this leaves the flag values that are apparently inconsistent but needed for the current implementation in Case 2 in SetImageForImageDocument(). - Changes the test-only behavior of Case 3, to set has_pending_load_event_ = true and image_complete_ = false in SetImageForTest(). This doesn't affect the tested behavior but fixes the assertion failures in [1]. [1] https://codereview.chromium.org/2859383002 BUG=624697, 719759 Review-Url: https://codereview.chromium.org/2864253003 Cr-Commit-Position: refs/heads/master@{#471177} Committed: https://chromium.googlesource.com/chromium/src/+/d5af742666d2acde551ac33e82f3d8662ffa0f15

Patch Set 1 #

Patch Set 2 : fix #

Patch Set 3 : Refine #

Total comments: 2

Patch Set 4 : Reflect comments #

Patch Set 5 : Rebase #

Patch Set 6 : Update comment #

Messages

Total messages: 46 (35 generated)
hiroshige
PTAL.
3 years, 7 months ago (2017-05-09 00:08:16 UTC) #11
hiroshige
3 years, 7 months ago (2017-05-09 00:46:48 UTC) #13
hiroshige
+fs@ if you interested. A concern here is the names are confusing: SetImage.*() are not ...
3 years, 7 months ago (2017-05-09 00:48:54 UTC) #14
fs
lgtm On 2017/05/09 at 00:48:54, hiroshige wrote: > +fs@ if you interested. > > A ...
3 years, 7 months ago (2017-05-09 08:29:56 UTC) #17
yhirano
lgtm
3 years, 7 months ago (2017-05-09 08:44:47 UTC) #18
hiroshige
Thanks! > For SetImageInternal though maybe we could call it UpdateImageState or UpdateStateFromImage or something ...
3 years, 7 months ago (2017-05-09 22:58:53 UTC) #19
hiroshige
https://codereview.chromium.org/2864253003/diff/40001/third_party/WebKit/Source/core/html/HTMLImageElement.h File third_party/WebKit/Source/core/html/HTMLImageElement.h (right): https://codereview.chromium.org/2864253003/diff/40001/third_party/WebKit/Source/core/html/HTMLImageElement.h#newcode86 third_party/WebKit/Source/core/html/HTMLImageElement.h:86: void SetImageForTest(ImageResourceContent* i) { On 2017/05/09 08:29:55, fs wrote: ...
3 years, 7 months ago (2017-05-09 23:07:57 UTC) #21
kouhei (in TOK)
lgtm
3 years, 7 months ago (2017-05-10 16:17:28 UTC) #23
hiroshige
Minor update in ImageLoader::SetImageForImageDocument(): Updated the comment and added a DCHECK().
3 years, 7 months ago (2017-05-10 22:24:52 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2864253003/100001
3 years, 7 months ago (2017-05-11 23:25:43 UTC) #43
commit-bot: I haz the power
3 years, 7 months ago (2017-05-12 01:56:13 UTC) #46
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/d5af742666d2acde551ac33e82f3...

Powered by Google App Engine
This is Rietveld 408576698