Skip to content

Commit 386f50d

Browse files
committed
remove console logs
1 parent c367423 commit 386f50d

File tree

1 file changed

+2
-42
lines changed

1 file changed

+2
-42
lines changed

infrastructure/testdriver/bidi/speculation/prefetch_status_updated.https.html

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@
1111
<script>
1212
promise_setup(async () => {
1313
await waitForDocumentReady();
14-
console.log('Document ready');
1514
await test_driver.bidi.speculation.prefetch_status_updated.subscribe();
16-
console.log('Setup: Subscribed to prefetch_status_updated events');
1715
});
1816

1917
promise_test(async t => {
20-
console.log('Test 1: Starting basic prefetch test');
2118

2219
const receivedEvents = [];
2320
const expectedEvents = ['pending', 'ready'];
@@ -32,12 +29,9 @@
3229
const validStatuses = ['pending', 'running', 'ready', 'success', 'failure'];
3330
assert_true(validStatuses.includes(event.status),
3431
`Event status should be one of ${validStatuses.join(', ')}, got: ${event.status}`);
35-
36-
console.log("URL: " + event.url + " with event status: " + event.status + " received");
3732

3833
// When we receive the ready event, clean up and resolve
3934
if (event.status === 'ready') {
40-
console.log('Received ready event, completing test');
4135
removeHandler();
4236
resolve();
4337
}
@@ -61,8 +55,6 @@
6155

6256
// Await the ready event
6357
await readyEventPromise;
64-
65-
console.log(`Test 1 completed, received ${receivedEvents.length} events`);
6658

6759
// Assert that we received the expected events
6860
assert_true(receivedEvents.length >= 2,
@@ -72,40 +64,31 @@
7264
expectedEvents,
7365
'Should have received pending and ready events in order'
7466
);
75-
console.log('✅ Test 1 passed: received expected events');
7667

7768
}, "prefetch_status_updated event subscription and structure validation");
7869

7970
promise_test(async t => {
80-
console.log('Test 2: Starting prefetch with navigation test');
8171

8272
const receivedEvents = [];
8373
const expectedEvents = ['pending', 'ready', 'success'];
8474
let newWindow = null;
85-
86-
console.log('Starting prefetch with navigation test');
8775

8876
// Create a promise that resolves when we receive the 'success' event
8977
const successEventPromise = new Promise((resolve, reject) => {
9078
const removeHandler = test_driver.bidi.speculation.prefetch_status_updated.on((event) => {
91-
console.log('Test 2: Received prefetch event:', event);
9279
receivedEvents.push(event);
9380

9481
// Status should be one of the expected values
9582
const validStatuses = ['pending', 'running', 'ready', 'success', 'failure'];
9683
assert_true(validStatuses.includes(event.status),
9784
`Event status should be one of ${validStatuses.join(', ')}, got: ${event.status}`);
98-
99-
console.log("Test 2 - URL: " + event.url + " with event status: " + event.status + " received");
10085

10186
// When we receive the ready event, navigate to trigger success
10287
if (event.status === 'ready') {
103-
console.log('Test 2: Received ready event, opening prefetched page in new window...');
10488
// Open the prefetched page in a new window to trigger success
10589
newWindow = window.open(event.url, '_blank');
10690

10791
} else if (event.status === 'success') {
108-
console.log('Test 2: Received success event, completing test');
10992
removeHandler();
11093
resolve();
11194
}
@@ -114,7 +97,6 @@
11497

11598
// Create prefetch rules for our target page in resources (different URL to avoid caching)
11699
const targetUrl = window.location.origin + "/infrastructure/testdriver/bidi/speculation/resources/target.html?test=2";
117-
console.log('Setting up prefetch for:', targetUrl);
118100

119101
const speculationRules = {
120102
prefetch: [{
@@ -123,17 +105,11 @@
123105
}]
124106
};
125107

126-
console.log('Adding speculation rules:', JSON.stringify(speculationRules));
127-
128108
// Use helper function to add both speculation rules and link
129109
const { script, link } = addSpeculationRulesAndLink(speculationRules, targetUrl);
130-
131-
console.log('Speculation rules and link added, waiting for success event...');
132-
110+
133111
// Await the success event
134112
await successEventPromise;
135-
136-
console.log(`Test 2 completed, received ${receivedEvents.length} events`);
137113

138114
// Assert that we received the expected events
139115
assert_true(receivedEvents.length >= 3,
@@ -143,7 +119,6 @@
143119
expectedEvents,
144120
'Should have received pending, ready, and success events in order'
145121
);
146-
console.log('✅ Test 2 passed: received expected events including success');
147122

148123
t.add_cleanup(() => {
149124
if (newWindow && !newWindow.closed) {
@@ -154,29 +129,22 @@
154129
}, "prefetch_status_updated event with navigation to success");
155130

156131
promise_test(async t => {
157-
console.log('Test 3: Starting prefetch failure test');
158-
132+
159133
const receivedEvents = [];
160134
const expectedEvents = ['pending', 'failure'];
161-
162-
console.log('Starting prefetch failure test');
163135

164136
// Create a promise that resolves when we receive the 'failure' event
165137
const failureEventPromise = new Promise((resolve, reject) => {
166138
const removeHandler = test_driver.bidi.speculation.prefetch_status_updated.on((event) => {
167-
console.log('Test 3: Received prefetch event:', event);
168139
receivedEvents.push(event);
169140

170141
// Status should be one of the expected values
171142
const validStatuses = ['pending', 'running', 'ready', 'success', 'failure'];
172143
assert_true(validStatuses.includes(event.status),
173144
`Event status should be one of ${validStatuses.join(', ')}, got: ${event.status}`);
174-
175-
console.log("Test 3 - URL: " + event.url + " with event status: " + event.status + " received");
176145

177146
// When we receive the failure event, we're done
178147
if (event.status === 'failure') {
179-
console.log('Test 3: Received failure event, completing test');
180148
removeHandler();
181149
resolve();
182150
}
@@ -185,7 +153,6 @@
185153

186154
// Create prefetch rules for a non-existent page that should fail with 404
187155
const errorUrl = window.location.origin + "/infrastructure/testdriver/bidi/speculation/resources/nonexistent-404-page.html";
188-
console.log('Setting up prefetch for non-existent page:', errorUrl);
189156

190157
const speculationRules = {
191158
prefetch: [{
@@ -194,17 +161,11 @@
194161
}]
195162
};
196163

197-
console.log('Adding speculation rules:', JSON.stringify(speculationRules));
198-
199164
// Use helper function to add both speculation rules and link
200165
const { script, link } = addSpeculationRulesAndLink(speculationRules, errorUrl);
201166

202-
console.log('Speculation rules and link added, waiting for failure event...');
203-
204167
// Await the failure event
205168
await failureEventPromise;
206-
207-
console.log(`Test 3 completed, received ${receivedEvents.length} events`);
208169

209170
// Assert that we received the expected events
210171
assert_true(receivedEvents.length >= 2,
@@ -214,7 +175,6 @@
214175
expectedEvents,
215176
'Should have received pending and failure events in order'
216177
);
217-
console.log('✅ Test 3 passed: received expected events including failure');
218178

219179
}, "prefetch_status_updated event with prefetch failure");
220180

0 commit comments

Comments
 (0)