Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / background_xhr / test_tls_client_auth.js
blob4a48af76a25e92fdfdb55bae7791da863292ee00
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // TODO(davidben): When URLSearchParams is stable and implemented, switch this
6 // (and a lot of other test code) to it. https://crbug.com/303152
7 var url = decodeURIComponent(/url=([^&]*)/.exec(location.search)[1]);
8 var filter = {urls: [url], types: ["xmlhttprequest"]};
10 chrome.webRequest.onCompleted.addListener(function(details) {
11   chrome.test.notifyFail("Request completed unexpectedly");
12 }, filter);
14 chrome.webRequest.onErrorOccurred.addListener(function(details) {
15   chrome.test.assertEq(-1, details.tabId);
16   chrome.test.assertEq(url, details.url);
17   chrome.test.assertEq("xmlhttprequest", details.type);
18   chrome.test.assertEq("net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED", details.error);
20   chrome.test.notifyPass();
21 }, filter);
23 chrome.runtime.sendMessage({type: "xhr", method: "GET", url: url});