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

Issue 2087293003: [DevTools] Network.emulateNetworkConditions now affects NetworkStateNotifier. (Closed)

Created:
4 years, 6 months ago by dgozman
Modified:
4 years, 5 months ago
Reviewers:
caseq, jkarlin, allada
CC:
chromium-reviews, caseq+blink_chromium.org, pfeldman+blink_chromium.org, posciak+watch_chromium.org, jam, mlamouri+watch-blink_chromium.org, eric.carlson_apple.com, feature-media-reviews_chromium.org, darin-cc_chromium.org, jkarlin+watch_chromium.org, devtools-reviews_chromium.org, blink-reviews, apavlov+blink_chromium.org, sergeyv+blink_chromium.org, lushnikov+blink_chromium.org, pfeldman, kozyatinskiy+blink_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[DevTools] Network.emulateNetworkConditions now affects NetworkStateNotifier. This patch replaces test-only update mechanism in NetworkStateNotifier with setOverride/clearOverride methods and uses them in InspectorNetworkAgent. Unfortunately for emulation, NetworkStateNotifier is global and thus all pages will observe the new network state. We can make it per-frame, but that would introduce a lot of complexity. Current state is an acceptable trade-off for now. This also adds connectionType parameter to Network.emulateNetworkConditions and makes it fall-through to the renderer. BUG=567613, 586696, 581334 Committed: https://crrev.com/6ca18e32edb9bad244588538ea2bb2d1be9fb1ff Cr-Commit-Position: refs/heads/master@{#402897}

Patch Set 1 #

Patch Set 2 : fall-through #

Patch Set 3 : browser test #

Total comments: 3

Patch Set 4 : test fixes #

Patch Set 5 : rebased, new test expectations #

Patch Set 6 : proper initialized checks #

Total comments: 5

Patch Set 7 : ScopedNotifier #

Total comments: 23

Patch Set 8 : addressed review comments #

Total comments: 19

Patch Set 9 : rebased #

Patch Set 10 : addressed more reviews comments #

Total comments: 2

Patch Set 11 : dcheck #

Unified diffs Side-by-side diffs Delta from patch set Stats (+404 lines, -147 lines) Patch
M chrome/browser/devtools/devtools_network_protocol_handler.cc View 1 1 chunk +1 line, -3 lines 0 comments Download
M chrome/browser/devtools/devtools_sanity_browsertest.cc View 1 2 2 chunks +15 lines, -0 lines 0 comments Download
A chrome/test/data/devtools/emulate_network_conditions.html View 1 2 1 chunk +11 lines, -0 lines 0 comments Download
M content/browser/devtools/protocol/network_handler.h View 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/devtools/protocol/network_handler.cc View 1 1 chunk +7 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-async-third-party-script.html View 1 chunk +2 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block.html View 1 chunk +2 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block-all-conn-types.html View 1 chunk +2 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block-all-conn-types-expected.txt View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-block-expected.txt View 1 2 3 4 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-conn-type.html View 1 chunk +2 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-conn-type-expected.txt View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-reload.html View 1 chunk +2 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/loading/doc-write-sync-third-party-script-reload-expected.txt View 1 2 3 4 1 chunk +6 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/webfont/font-display-intervention.html View 1 chunk +2 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/media/video-preload-cellular-test.js View 2 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/netinfo/basic-operation.html View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/netinfo/connection-types.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/netinfo/multiple-frames.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/netinfo/resources/netinfo_common.js View 1 2 3 1 chunk +5 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/netinfo/type-change-no-listener.html View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/netinfo/unregister-during-event.html View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/netinfo/web-worker.html View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp View 1 2 3 4 5 6 7 8 4 chunks +40 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/inspector/browser_protocol.json View 1 2 3 4 5 6 7 8 2 chunks +9 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/page/NetworkStateNotifier.h View 1 2 3 4 5 6 7 8 9 7 chunks +43 lines, -31 lines 0 comments Download
M third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp View 1 2 3 4 5 6 7 8 9 10 2 chunks +49 lines, -39 lines 0 comments Download
M third_party/WebKit/Source/core/page/NetworkStateNotifierTest.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +91 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.h View 1 chunk +2 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.cpp View 2 chunks +7 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.idl View 1 chunk +3 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/devtools/front_end/Tests.js View 1 2 3 4 5 6 1 chunk +53 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/devtools/front_end/sdk/NetworkManager.js View 1 2 3 4 5 6 7 8 9 2 chunks +28 lines, -1 line 0 comments Download

Messages

Total messages: 48 (18 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2087293003/40001
4 years, 6 months ago (2016-06-23 01:49:15 UTC) #4
dgozman
Hi, Could you please take a look: - caseq, allada at the whole patch; - ...
4 years, 6 months ago (2016-06-23 01:50:35 UTC) #6
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: android_arm64_dbg_recipe on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm64_dbg_recipe/builds/85727)
4 years, 6 months ago (2016-06-23 02:24:45 UTC) #8
jkarlin
https://codereview.chromium.org/2087293003/diff/40001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/40001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode152 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:152: double maxBandwidthMbps = maxBandwidth(); The underlying values of type ...
4 years, 6 months ago (2016-06-23 12:53:46 UTC) #9
dgozman
https://codereview.chromium.org/2087293003/diff/40001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/40001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode152 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:152: double maxBandwidthMbps = maxBandwidth(); On 2016/06/23 12:53:46, jkarlin wrote: ...
4 years, 6 months ago (2016-06-23 15:00:22 UTC) #10
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2087293003/60001
4 years, 6 months ago (2016-06-23 18:19:44 UTC) #12
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/190642) mac_chromium_rel_ng on ...
4 years, 6 months ago (2016-06-23 19:06:04 UTC) #14
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2087293003/80001
4 years, 6 months ago (2016-06-23 19:40:22 UTC) #16
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/190697)
4 years, 6 months ago (2016-06-23 20:25:52 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2087293003/100001
4 years, 6 months ago (2016-06-23 21:44:16 UTC) #20
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/244464)
4 years, 6 months ago (2016-06-23 23:31:18 UTC) #22
jkarlin
https://codereview.chromium.org/2087293003/diff/40001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/40001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode152 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:152: double maxBandwidthMbps = maxBandwidth(); On 2016/06/23 15:00:22, dgozman wrote: ...
4 years, 6 months ago (2016-06-24 14:47:50 UTC) #23
dgozman
https://codereview.chromium.org/2087293003/diff/100001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/100001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode131 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:131: Page::networkStateChanged(onLine()); On 2016/06/24 14:47:50, jkarlin wrote: > setOnline and ...
4 years, 6 months ago (2016-06-24 15:13:44 UTC) #24
jkarlin
https://codereview.chromium.org/2087293003/diff/100001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/100001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode131 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:131: Page::networkStateChanged(onLine()); On 2016/06/24 15:13:44, dgozman wrote: > On 2016/06/24 ...
4 years, 6 months ago (2016-06-24 19:20:16 UTC) #25
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2087293003/120001
4 years, 5 months ago (2016-06-27 21:14:14 UTC) #27
dgozman
Please take another look. I've refactored a bit to ensure proper notifications. https://codereview.chromium.org/2087293003/diff/100001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp ...
4 years, 5 months ago (2016-06-27 23:03:49 UTC) #28
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 5 months ago (2016-06-28 00:13:00 UTC) #30
jkarlin
https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode49 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:49: m_notifier.m_mutex.lock(); It's not obvious that a "notifier" would acquire ...
4 years, 5 months ago (2016-06-28 14:23:41 UTC) #31
dgozman
See some comments. I will change the rest. https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode49 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:49: m_notifier.m_mutex.lock(); ...
4 years, 5 months ago (2016-06-28 14:34:35 UTC) #32
dgozman
Please take another look. https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode53 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:53: NetworkStateNotifier::ScopedNotifier::~ScopedNotifier() On 2016/06/28 14:23:41, jkarlin ...
4 years, 5 months ago (2016-06-28 17:14:24 UTC) #33
jkarlin
https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode49 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:49: m_notifier.m_mutex.lock(); On 2016/06/28 14:34:35, dgozman wrote: > On 2016/06/28 ...
4 years, 5 months ago (2016-06-28 17:57:12 UTC) #34
allada
Just a few minor things. https://codereview.chromium.org/2087293003/diff/140001/third_party/WebKit/LayoutTests/netinfo/resources/netinfo_common.js File third_party/WebKit/LayoutTests/netinfo/resources/netinfo_common.js (right): https://codereview.chromium.org/2087293003/diff/140001/third_party/WebKit/LayoutTests/netinfo/resources/netinfo_common.js#newcode14 third_party/WebKit/LayoutTests/netinfo/resources/netinfo_common.js:14: window.addEventListener('beforeunload', function() { (please ...
4 years, 5 months ago (2016-06-28 22:34:15 UTC) #35
dgozman
Please take another look. https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/120001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode49 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:49: m_notifier.m_mutex.lock(); On 2016/06/28 17:57:11, jkarlin ...
4 years, 5 months ago (2016-06-29 01:17:33 UTC) #37
jkarlin
NetworkStateNotifier.h/cpp/unittest lgtm with nit https://codereview.chromium.org/2087293003/diff/200001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/200001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode53 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:53: { DCHECK(isMainThread());
4 years, 5 months ago (2016-06-29 14:00:18 UTC) #38
dgozman
Thanks for review! @allada: take another look please. https://codereview.chromium.org/2087293003/diff/200001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp File third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp (right): https://codereview.chromium.org/2087293003/diff/200001/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp#newcode53 third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp:53: { ...
4 years, 5 months ago (2016-06-29 16:11:19 UTC) #39
allada
lgtm
4 years, 5 months ago (2016-06-29 17:49:14 UTC) #40
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/2087293003/220001
4 years, 5 months ago (2016-06-29 17:55:33 UTC) #43
commit-bot: I haz the power
Committed patchset #11 (id:220001)
4 years, 5 months ago (2016-06-29 19:30:46 UTC) #45
commit-bot: I haz the power
CQ bit was unchecked.
4 years, 5 months ago (2016-06-29 19:31:18 UTC) #46
commit-bot: I haz the power
4 years, 5 months ago (2016-06-29 19:32:46 UTC) #48
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/6ca18e32edb9bad244588538ea2bb2d1be9fb1ff
Cr-Commit-Position: refs/heads/master@{#402897}

Powered by Google App Engine
This is Rietveld 408576698