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

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <utility> 5 #include <utility>
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/test/histogram_tester.h" 20 #include "base/test/histogram_tester.h"
21 #include "base/test/scoped_feature_list.h" 21 #include "base/test/scoped_feature_list.h"
22 #include "base/test/simple_test_clock.h" 22 #include "base/test/simple_test_clock.h"
23 #include "base/threading/thread_restrictions.h"
23 #include "base/threading/thread_task_runner_handle.h" 24 #include "base/threading/thread_task_runner_handle.h"
24 #include "base/time/default_clock.h" 25 #include "base/time/default_clock.h"
25 #include "base/time/default_tick_clock.h" 26 #include "base/time/default_tick_clock.h"
26 #include "base/time/time.h" 27 #include "base/time/time.h"
27 #include "build/build_config.h" 28 #include "build/build_config.h"
28 #include "chrome/app/chrome_command_ids.h" 29 #include "chrome/app/chrome_command_ids.h"
29 #include "chrome/browser/browser_process.h" 30 #include "chrome/browser/browser_process.h"
30 #include "chrome/browser/chrome_notification_types.h" 31 #include "chrome/browser/chrome_notification_types.h"
31 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 32 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
32 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" 33 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 // See http://crbug.com/51132 1347 // See http://crbug.com/51132
1347 1348
1348 // Visit a HTTPS page which requires client cert authentication. The client 1349 // Visit a HTTPS page which requires client cert authentication. The client
1349 // cert will be selected automatically, then a test which uses WebSocket runs. 1350 // cert will be selected automatically, then a test which uses WebSocket runs.
1350 IN_PROC_BROWSER_TEST_F(SSLUITestWithClientCert, TestWSSClientCert) { 1351 IN_PROC_BROWSER_TEST_F(SSLUITestWithClientCert, TestWSSClientCert) {
1351 // Import a client cert for test. 1352 // Import a client cert for test.
1352 crypto::ScopedPK11Slot public_slot = cert_db_->GetPublicSlot(); 1353 crypto::ScopedPK11Slot public_slot = cert_db_->GetPublicSlot();
1353 std::string pkcs12_data; 1354 std::string pkcs12_data;
1354 base::FilePath cert_path = net::GetTestCertsDirectory().Append( 1355 base::FilePath cert_path = net::GetTestCertsDirectory().Append(
1355 FILE_PATH_LITERAL("websocket_client_cert.p12")); 1356 FILE_PATH_LITERAL("websocket_client_cert.p12"));
1356 EXPECT_TRUE(base::ReadFileToString(cert_path, &pkcs12_data)); 1357 {
1358 base::ThreadRestrictions::ScopedAllowIO allow_io;
1359 EXPECT_TRUE(base::ReadFileToString(cert_path, &pkcs12_data));
1360 }
1357 EXPECT_EQ(net::OK, cert_db_->ImportFromPKCS12(public_slot.get(), pkcs12_data, 1361 EXPECT_EQ(net::OK, cert_db_->ImportFromPKCS12(public_slot.get(), pkcs12_data,
1358 base::string16(), true, NULL)); 1362 base::string16(), true, NULL));
1359 1363
1360 // Start WebSocket test server with TLS and client cert authentication. 1364 // Start WebSocket test server with TLS and client cert authentication.
1361 net::SpawnedTestServer::SSLOptions options( 1365 net::SpawnedTestServer::SSLOptions options(
1362 net::SpawnedTestServer::SSLOptions::CERT_OK); 1366 net::SpawnedTestServer::SSLOptions::CERT_OK);
1363 options.request_client_certificate = true; 1367 options.request_client_certificate = true;
1364 base::FilePath ca_path = net::GetTestCertsDirectory().Append( 1368 base::FilePath ca_path = net::GetTestCertsDirectory().Append(
1365 FILE_PATH_LITERAL("websocket_cacert.pem")); 1369 FILE_PATH_LITERAL("websocket_cacert.pem"));
1366 options.client_authorities.push_back(ca_path); 1370 options.client_authorities.push_back(ca_path);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 ->GetDelegateForTesting() 1433 ->GetDelegateForTesting()
1430 ->GetTypeForTesting()); 1434 ->GetTypeForTesting());
1431 } 1435 }
1432 1436
1433 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) { 1437 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) {
1434 ASSERT_TRUE(embedded_test_server()->Start()); 1438 ASSERT_TRUE(embedded_test_server()->Start());
1435 ASSERT_TRUE(https_server_expired_.Start()); 1439 ASSERT_TRUE(https_server_expired_.Start());
1436 GURL url_non_dangerous = embedded_test_server()->GetURL("/title1.html"); 1440 GURL url_non_dangerous = embedded_test_server()->GetURL("/title1.html");
1437 GURL url_dangerous = 1441 GURL url_dangerous =
1438 https_server_expired_.GetURL("/downloads/dangerous/dangerous.exe"); 1442 https_server_expired_.GetURL("/downloads/dangerous/dangerous.exe");
1443 base::ThreadRestrictions::ScopedAllowIO allow_io;
1439 base::ScopedTempDir downloads_directory_; 1444 base::ScopedTempDir downloads_directory_;
1440 1445
1441 // Need empty temp dir to avoid having Chrome ask us for a new filename 1446 // Need empty temp dir to avoid having Chrome ask us for a new filename
1442 // when we've downloaded dangerous.exe one hundred times. 1447 // when we've downloaded dangerous.exe one hundred times.
1443 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); 1448 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir());
1444 1449
1445 browser()->profile()->GetPrefs()->SetFilePath( 1450 browser()->profile()->GetPrefs()->SetFilePath(
1446 prefs::kDownloadDefaultDirectory, downloads_directory_.GetPath()); 1451 prefs::kDownloadDefaultDirectory, downloads_directory_.GetPath());
1447 1452
1448 // Visit a non-dangerous page. 1453 // Visit a non-dangerous page.
(...skipping 2997 matching lines...) Expand 10 before | Expand all | Expand 10 after
4446 4451
4447 // Visit a page over https that contains a frame with a redirect. 4452 // Visit a page over https that contains a frame with a redirect.
4448 4453
4449 // XMLHttpRequest insecure content in synchronous mode. 4454 // XMLHttpRequest insecure content in synchronous mode.
4450 4455
4451 // XMLHttpRequest insecure content in asynchronous mode. 4456 // XMLHttpRequest insecure content in asynchronous mode.
4452 4457
4453 // XMLHttpRequest over bad ssl in synchronous mode. 4458 // XMLHttpRequest over bad ssl in synchronous mode.
4454 4459
4455 // XMLHttpRequest over OK ssl in synchronous mode. 4460 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698