Commit ea8e89cf authored by Andrey Lushnikov's avatar Andrey Lushnikov Committed by Commit Bot

DevTools: stop idleness detector when pending navigation commits

This patch stops indleness detector when a new document gets committed.
This makes sure that networkIdle events for the previous document don't
come for the newly committed one.

Drive-by: cleanup test.

R=pfeldman

Change-Id: Ia0cbcbbda31e07957867c53641649dd80091281e
Reviewed-on: https://chromium-review.googlesource.com/745388Reviewed-by: default avatarPavel Feldman <pfeldman@chromium.org>
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512760}
parent 0cec62ea
...@@ -7,15 +7,13 @@ ...@@ -7,15 +7,13 @@
var events = []; var events = [];
dp.Page.onLifecycleEvent(result => { dp.Page.onLifecycleEvent(result => {
events.push(result.params.name); events.push(result.params.name);
if (events.includes('networkIdle') && events.includes('networkAlmostIdle')) { if (events.includes('networkIdle')) {
// 'load' can come before 'DOMContentLoaded'
events.sort(); events.sort();
testRunner.log(events); testRunner.log(events);
testRunner.completeTest(); testRunner.completeTest();
} }
}); });
// It's possible for Blink to finish the load and run out of tasks before dp.Page.navigate({url: "data:text/html,Hello!"});
// network idle lifecycle events are generated. Add a timeout
// greater than the network quiet window to guarantee that those events fire.
dp.Page.navigate({url: "data:text/html,Hello! <script>setTimeout(() => {}, 2000);</script>"});
}) })
...@@ -20,6 +20,8 @@ void IdlenessDetector::Shutdown() { ...@@ -20,6 +20,8 @@ void IdlenessDetector::Shutdown() {
} }
void IdlenessDetector::WillCommitLoad() { void IdlenessDetector::WillCommitLoad() {
network_2_quiet_ = -1;
network_0_quiet_ = -1;
network_2_quiet_start_time_ = 0; network_2_quiet_start_time_ = 0;
network_0_quiet_start_time_ = 0; network_0_quiet_start_time_ = 0;
} }
......
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