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

Unified Diff: chrome/browser/extensions/xhr_apitest.cc

Issue 859213006: Cancel client auth requests when not promptable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client-auth-cancel-1
Patch Set: extension test Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/xhr_apitest.cc
diff --git a/chrome/browser/extensions/xhr_apitest.cc b/chrome/browser/extensions/xhr_apitest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..40c3b292efc4cf799ea372a5775b8afd898b9740
--- /dev/null
+++ b/chrome/browser/extensions/xhr_apitest.cc
@@ -0,0 +1,29 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/extension_apitest.h"
+#include "net/test/spawned_test_server/spawned_test_server.h"
+
+// Test that fetching a URL using TLS client auth doesn't crash, hang, or
+// prompt.
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, XhrTlsClientAuth) {
+ // Launch HTTPS server.
+ net::SpawnedTestServer::SSLOptions ssl_options;
+ ssl_options.request_client_certificate = true;
+ net::SpawnedTestServer https_server(
+ net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
+ base::FilePath(FILE_PATH_LITERAL("content/test/data")));
+ ASSERT_TRUE(https_server.Start());
+
+ std::string url = https_server.GetURL("").spec();
+ ASSERT_TRUE(RunExtensionTestWithArg("xhr", url.c_str())) << message_;
davidben 2015/02/06 22:39:38 It's a bit of a nuisance that this test (and the o
mmenke 2015/02/10 17:19:10 Can we check if the displayed page has ERR_SSL_CLI
davidben 2015/02/10 20:28:49 It's an XHR made by the background page of an exte
mmenke 2015/02/10 20:39:20 Oh...Erm...right, was forgetting this wasn't a nav
davidben 2015/02/10 22:20:52 Mmm. I'm a little worried about these tests swappi
+}
+
+// Test that fetching a URL using HTTP auth doesn't crash, hang, or prompt.
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, XhrHttpAuth) {
+ ASSERT_TRUE(StartSpawnedTestServer());
+
+ std::string url = test_server()->GetURL("/auth-basic").spec();
+ ASSERT_TRUE(RunExtensionTestWithArg("xhr", url.c_str())) << message_;
+}

Powered by Google App Engine
This is Rietveld 408576698