| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Generates a unique authentication URL so each test can run | 5 // Generates a unique authentication URL so each test can run |
| 6 // without hitting the HTTP authentication cache. Each test | 6 // without hitting the HTTP authentication cache. Each test |
| 7 // must use a unique realm, however. | 7 // must use a unique realm, however. |
| 8 function getURLAuthRequired(realm) { | 8 function getURLAuthRequired(realm) { |
| 9 return getServerURL('auth-basic/' + realm + '/subpath?realm=' + realm); | 9 return getServerURL('auth-basic/' + realm + '/subpath?realm=' + realm); |
| 10 } | 10 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 responseHeadersExist: true, | 77 responseHeadersExist: true, |
| 78 statusLine: "HTTP/1.0 401 Unauthorized", | 78 statusLine: "HTTP/1.0 401 Unauthorized", |
| 79 } | 79 } |
| 80 }, | 80 }, |
| 81 ], | 81 ], |
| 82 [ // event order | 82 [ // event order |
| 83 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", | 83 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", |
| 84 "onHeadersReceived", "onAuthRequired", "onResponseStarted", | 84 "onHeadersReceived", "onAuthRequired", "onResponseStarted", |
| 85 "onCompleted"] | 85 "onCompleted"] |
| 86 ], | 86 ], |
| 87 {}, ["responseHeaders"]); | 87 {urls: ["<all_urls>"]}, ["responseHeaders"]); |
| 88 navigateAndWait(url); | 88 navigateAndWait(url); |
| 89 }, | 89 }, |
| 90 | 90 |
| 91 // onAuthRequired is a blocking function but takes no action in this variant. | 91 // onAuthRequired is a blocking function but takes no action in this variant. |
| 92 function authRequiredSyncNoAction() { | 92 function authRequiredSyncNoAction() { |
| 93 var realm = 'syncnoaction'; | 93 var realm = 'syncnoaction'; |
| 94 var url = getURLAuthRequired(realm); | 94 var url = getURLAuthRequired(realm); |
| 95 expect( | 95 expect( |
| 96 [ // events | 96 [ // events |
| 97 { label: "onBeforeRequest", | 97 { label: "onBeforeRequest", |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 responseHeadersExist: true, | 155 responseHeadersExist: true, |
| 156 statusLine: "HTTP/1.0 401 Unauthorized", | 156 statusLine: "HTTP/1.0 401 Unauthorized", |
| 157 } | 157 } |
| 158 }, | 158 }, |
| 159 ], | 159 ], |
| 160 [ // event order | 160 [ // event order |
| 161 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", | 161 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", |
| 162 "onHeadersReceived", "onAuthRequired", "onResponseStarted", | 162 "onHeadersReceived", "onAuthRequired", "onResponseStarted", |
| 163 "onCompleted"] | 163 "onCompleted"] |
| 164 ], | 164 ], |
| 165 {}, ["blocking", "responseHeaders"]); | 165 {urls: ["<all_urls>"]}, ["blocking", "responseHeaders"]); |
| 166 navigateAndWait(url); | 166 navigateAndWait(url); |
| 167 }, | 167 }, |
| 168 | 168 |
| 169 // onAuthRequired is a blocking function that cancels the auth attempt. | 169 // onAuthRequired is a blocking function that cancels the auth attempt. |
| 170 function authRequiredSyncCancelAuth() { | 170 function authRequiredSyncCancelAuth() { |
| 171 var realm = 'synccancel'; | 171 var realm = 'synccancel'; |
| 172 var url = getURLAuthRequired(realm); | 172 var url = getURLAuthRequired(realm); |
| 173 expect( | 173 expect( |
| 174 [ // events | 174 [ // events |
| 175 { label: "onBeforeRequest", | 175 { label: "onBeforeRequest", |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 responseHeadersExist: true, | 236 responseHeadersExist: true, |
| 237 statusLine: "HTTP/1.0 401 Unauthorized", | 237 statusLine: "HTTP/1.0 401 Unauthorized", |
| 238 } | 238 } |
| 239 }, | 239 }, |
| 240 ], | 240 ], |
| 241 [ // event order | 241 [ // event order |
| 242 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", | 242 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", |
| 243 "onHeadersReceived", "onAuthRequired", "onResponseStarted", | 243 "onHeadersReceived", "onAuthRequired", "onResponseStarted", |
| 244 "onCompleted"] | 244 "onCompleted"] |
| 245 ], | 245 ], |
| 246 {}, | 246 {urls: ["<all_urls>"]}, |
| 247 ["responseHeaders", "blocking"]); | 247 ["responseHeaders", "blocking"]); |
| 248 navigateAndWait(url); | 248 navigateAndWait(url); |
| 249 }, | 249 }, |
| 250 | 250 |
| 251 // onAuthRequired is a blocking function that sets authentication credentials. | 251 // onAuthRequired is a blocking function that sets authentication credentials. |
| 252 function authRequiredSyncSetAuth() { | 252 function authRequiredSyncSetAuth() { |
| 253 var realm = 'syncsetauth'; | 253 var realm = 'syncsetauth'; |
| 254 var url = getURLAuthRequired(realm); | 254 var url = getURLAuthRequired(realm); |
| 255 expect( | 255 expect( |
| 256 [ // events | 256 [ // events |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 responseHeadersExist: true, | 318 responseHeadersExist: true, |
| 319 statusLine: "HTTP/1.1 200 OK", | 319 statusLine: "HTTP/1.1 200 OK", |
| 320 } | 320 } |
| 321 }, | 321 }, |
| 322 ], | 322 ], |
| 323 [ // event order | 323 [ // event order |
| 324 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", | 324 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", |
| 325 "onHeadersReceived", "onAuthRequired", "onResponseStarted", | 325 "onHeadersReceived", "onAuthRequired", "onResponseStarted", |
| 326 "onCompleted"] | 326 "onCompleted"] |
| 327 ], | 327 ], |
| 328 {}, | 328 {urls: ["<all_urls>"]}, |
| 329 ["responseHeaders", "blocking"]); | 329 ["responseHeaders", "blocking"]); |
| 330 navigateAndWait(url); | 330 navigateAndWait(url); |
| 331 }, | 331 }, |
| 332 | 332 |
| 333 // onAuthRequired is an async function but takes no action in this variant. | 333 // onAuthRequired is an async function but takes no action in this variant. |
| 334 function authRequiredAsyncNoAction() { | 334 function authRequiredAsyncNoAction() { |
| 335 var realm = 'asyncnoaction'; | 335 var realm = 'asyncnoaction'; |
| 336 var url = getURLAuthRequired(realm); | 336 var url = getURLAuthRequired(realm); |
| 337 expect( | 337 expect( |
| 338 [ // events | 338 [ // events |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 responseHeadersExist: true, | 397 responseHeadersExist: true, |
| 398 statusLine: "HTTP/1.0 401 Unauthorized", | 398 statusLine: "HTTP/1.0 401 Unauthorized", |
| 399 } | 399 } |
| 400 }, | 400 }, |
| 401 ], | 401 ], |
| 402 [ // event order | 402 [ // event order |
| 403 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", | 403 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", |
| 404 "onHeadersReceived", "onAuthRequired", "onResponseStarted", | 404 "onHeadersReceived", "onAuthRequired", "onResponseStarted", |
| 405 "onCompleted"] | 405 "onCompleted"] |
| 406 ], | 406 ], |
| 407 {}, ["asyncBlocking", "responseHeaders"]); | 407 {urls: ["<all_urls>"]}, ["asyncBlocking", "responseHeaders"]); |
| 408 navigateAndWait(url); | 408 navigateAndWait(url); |
| 409 }, | 409 }, |
| 410 | 410 |
| 411 // onAuthRequired is an async function that cancels the auth attempt. | 411 // onAuthRequired is an async function that cancels the auth attempt. |
| 412 function authRequiredAsyncCancelAuth() { | 412 function authRequiredAsyncCancelAuth() { |
| 413 var realm = 'asynccancel'; | 413 var realm = 'asynccancel'; |
| 414 var url = getURLAuthRequired(realm); | 414 var url = getURLAuthRequired(realm); |
| 415 expect( | 415 expect( |
| 416 [ // events | 416 [ // events |
| 417 { label: "onBeforeRequest", | 417 { label: "onBeforeRequest", |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 responseHeadersExist: true, | 478 responseHeadersExist: true, |
| 479 statusLine: "HTTP/1.0 401 Unauthorized", | 479 statusLine: "HTTP/1.0 401 Unauthorized", |
| 480 } | 480 } |
| 481 }, | 481 }, |
| 482 ], | 482 ], |
| 483 [ // event order | 483 [ // event order |
| 484 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", | 484 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", |
| 485 "onHeadersReceived", "onAuthRequired", "onResponseStarted", | 485 "onHeadersReceived", "onAuthRequired", "onResponseStarted", |
| 486 "onCompleted"] | 486 "onCompleted"] |
| 487 ], | 487 ], |
| 488 {}, | 488 {urls: ["<all_urls>"]}, |
| 489 ["responseHeaders", "asyncBlocking"]); | 489 ["responseHeaders", "asyncBlocking"]); |
| 490 navigateAndWait(url); | 490 navigateAndWait(url); |
| 491 }, | 491 }, |
| 492 | 492 |
| 493 // onAuthRequired is an async function that sets authentication credentials. | 493 // onAuthRequired is an async function that sets authentication credentials. |
| 494 function authRequiredAsyncSetAuth() { | 494 function authRequiredAsyncSetAuth() { |
| 495 var realm = 'asyncsetauth'; | 495 var realm = 'asyncsetauth'; |
| 496 var url = getURLAuthRequired(realm); | 496 var url = getURLAuthRequired(realm); |
| 497 expect( | 497 expect( |
| 498 [ // events | 498 [ // events |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 responseHeadersExist: true, | 560 responseHeadersExist: true, |
| 561 statusLine: "HTTP/1.1 200 OK", | 561 statusLine: "HTTP/1.1 200 OK", |
| 562 } | 562 } |
| 563 }, | 563 }, |
| 564 ], | 564 ], |
| 565 [ // event order | 565 [ // event order |
| 566 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", | 566 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", |
| 567 "onHeadersReceived", "onAuthRequired", "onResponseStarted", | 567 "onHeadersReceived", "onAuthRequired", "onResponseStarted", |
| 568 "onCompleted"] | 568 "onCompleted"] |
| 569 ], | 569 ], |
| 570 {}, | 570 {urls: ["<all_urls>"]}, |
| 571 ["responseHeaders", "asyncBlocking"]); | 571 ["responseHeaders", "asyncBlocking"]); |
| 572 navigateAndWait(url); | 572 navigateAndWait(url); |
| 573 }, | 573 }, |
| 574 ]); | 574 ]); |
| OLD | NEW |