OLD | NEW |
---|---|
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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 #include "content/public/browser/navigation_entry.h" | 47 #include "content/public/browser/navigation_entry.h" |
48 #include "content/public/browser/notification_observer.h" | 48 #include "content/public/browser/notification_observer.h" |
49 #include "content/public/browser/notification_registrar.h" | 49 #include "content/public/browser/notification_registrar.h" |
50 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
51 #include "content/public/browser/notification_types.h" | 51 #include "content/public/browser/notification_types.h" |
52 #include "content/public/browser/render_frame_host.h" | 52 #include "content/public/browser/render_frame_host.h" |
53 #include "content/public/browser/web_contents.h" | 53 #include "content/public/browser/web_contents.h" |
54 #include "content/public/common/url_constants.h" | 54 #include "content/public/common/url_constants.h" |
55 #include "content/public/test/browser_test_utils.h" | 55 #include "content/public/test/browser_test_utils.h" |
56 #include "net/base/net_errors.h" | 56 #include "net/base/net_errors.h" |
57 #include "net/cert/x509_certificate.h" | |
57 #include "net/http/transport_security_state.h" | 58 #include "net/http/transport_security_state.h" |
59 #include "net/test/test_certificate_data.h" | |
58 #include "net/test/url_request/url_request_failed_job.h" | 60 #include "net/test/url_request/url_request_failed_job.h" |
59 #include "net/test/url_request/url_request_mock_http_job.h" | 61 #include "net/test/url_request/url_request_mock_http_job.h" |
60 #include "net/url_request/url_request.h" | 62 #include "net/url_request/url_request.h" |
61 #include "net/url_request/url_request_context.h" | 63 #include "net/url_request/url_request_context.h" |
62 #include "net/url_request/url_request_context_getter.h" | 64 #include "net/url_request/url_request_context_getter.h" |
63 #include "net/url_request/url_request_filter.h" | 65 #include "net/url_request/url_request_filter.h" |
64 #include "net/url_request/url_request_interceptor.h" | 66 #include "net/url_request/url_request_interceptor.h" |
65 #include "net/url_request/url_request_job.h" | 67 #include "net/url_request/url_request_job.h" |
66 #include "net/url_request/url_request_status.h" | 68 #include "net/url_request/url_request_status.h" |
67 #include "testing/gtest/include/gtest/gtest.h" | 69 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 // it from the job list before the error. | 340 // it from the job list before the error. |
339 EXPECT_TRUE(job->RemoveFromList()); | 341 EXPECT_TRUE(job->RemoveFromList()); |
340 if (end_job_operation == FAIL_JOBS) { | 342 if (end_job_operation == FAIL_JOBS) { |
341 job->NotifyStartError(net::URLRequestStatus( | 343 job->NotifyStartError(net::URLRequestStatus( |
342 net::URLRequestStatus::FAILED, | 344 net::URLRequestStatus::FAILED, |
343 net::ERR_CONNECTION_TIMED_OUT)); | 345 net::ERR_CONNECTION_TIMED_OUT)); |
344 } else if (end_job_operation == FAIL_JOBS_WITH_CERT_ERROR) { | 346 } else if (end_job_operation == FAIL_JOBS_WITH_CERT_ERROR) { |
345 DCHECK(job->request()->url().SchemeIsCryptographic()); | 347 DCHECK(job->request()->url().SchemeIsCryptographic()); |
346 net::SSLInfo info; | 348 net::SSLInfo info; |
347 info.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; | 349 info.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; |
348 info.cert = new net::X509Certificate( | 350 info.cert = net::X509Certificate::CreateFromBytes( |
349 "bad.host", "CA", base::Time::Max(), base::Time::Max()); | 351 reinterpret_cast<const char*>(google_der), sizeof(google_der)); |
Ryan Sleevi
2015/08/07 00:14:10
I would encourage you to use ImportCertFromFile us
Bhanu Dev
2015/08/07 22:28:48
Done.
| |
350 job->NotifySSLCertificateError(info, true); | 352 job->NotifySSLCertificateError(info, true); |
351 } | 353 } |
352 } | 354 } |
353 | 355 |
354 EXPECT_EQ(expected_num_jobs, num_jobs_started_); | 356 EXPECT_EQ(expected_num_jobs, num_jobs_started_); |
355 EXPECT_EQ(expected_num_jobs, num_jobs); | 357 EXPECT_EQ(expected_num_jobs, num_jobs); |
356 | 358 |
357 num_jobs_started_ -= expected_num_jobs; | 359 num_jobs_started_ -= expected_num_jobs; |
358 } | 360 } |
359 | 361 |
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2868 | 2870 |
2869 EXPECT_EQ(CaptivePortalTabReloader::STATE_NEEDS_RELOAD, | 2871 EXPECT_EQ(CaptivePortalTabReloader::STATE_NEEDS_RELOAD, |
2870 GetStateOfTabReloaderAt(browser(), broken_tab_index)); | 2872 GetStateOfTabReloaderAt(browser(), broken_tab_index)); |
2871 | 2873 |
2872 WaitForInterstitialAttach(broken_tab_contents); | 2874 WaitForInterstitialAttach(broken_tab_contents); |
2873 portal_observer.WaitForResults(1); | 2875 portal_observer.WaitForResults(1); |
2874 | 2876 |
2875 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, | 2877 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, |
2876 GetInterstitialType(broken_tab_contents)); | 2878 GetInterstitialType(broken_tab_contents)); |
2877 } | 2879 } |
OLD | NEW |