src/net/cert/internal/cert_issuer_source_aia_unittest.cc
TEST(CertIssuerSourceAiaTest, FileAia) {
  scoped_refptr<ParsedCertificate> cert;
  ASSERT_TRUE(ReadTestCert("target_file_aia.pem", &cert));

  auto mock_fetcher = base::MakeRefCounted<StrictMock<MockCertNetFetcher>>();
  EXPECT_CALL(*mock_fetcher, FetchCaIssuers(GURL("file:///dev/null"), _, _))
      .WillOnce(Return(ByMove(CreateMockRequest(ERR_DISALLOWED_URL_SCHEME))));

  CertIssuerSourceAia aia_source(mock_fetcher);
  std::unique_ptr<CertIssuerSource::Request> cert_source_request;
  aia_source.AsyncGetIssuersOf(cert.get(), &cert_source_request);
  ASSERT_NE(nullptr, cert_source_request);

  // No results.
  ParsedCertificateList result_certs;
  cert_source_request->GetNext(&result_certs);
  EXPECT_TRUE(result_certs.empty());
}
// If the AuthorityInfoAccess extension only contains non-HTTP URIs,
// AsyncGetIssuersOf should create a Request object. The URL scheme check is
// part of the specific CertNetFetcher implementation, this tests that we handle
// ERR_DISALLOWED_URL_SCHEME properly. If FetchCaIssuers is modified to fail
// synchronously in that case, this test will be more interesting.
If the AuthorityInfoAccess extension only contains non-HTTP URIs,
AsyncGetIssuersOf should create a Request object. The URL scheme check is
part of the specific CertNetFetcher implementation, this tests that we handle
ERR_DISALLOWED_URL_SCHEME properly. If FetchCaIssuers is modified to fail
synchronously in that case, this test will be more interesting.
If the AuthorityInfoAccess extension only contains non - HTTP URIs AsyncGetIssuersOf should create a Request object . The URL scheme check is part of the specific CertNetFetcher implementation this tests that we handle ERR_DISALLOWED_URL_SCHEME properly . If FetchCaIssuers is modified to fail synchronously in that case this test will be more interesting .
TEST(CertIssuerSourceAiaTest, FileAia) {
  scoped_refptr<ParsedCertificate> cert;
  ASSERT_TRUE(ReadTestCert("target_file_aia.pem", &cert));
  auto mock_fetcher = base::MakeRefCounted<StrictMock<MockCertNetFetcher>>();
  EXPECT_CALL(*mock_fetcher, FetchCaIssuers(GURL("file:///dev/null"), _, _))
      .WillOnce(Return(ByMove(CreateMockRequest(ERR_DISALLOWED_URL_SCHEME))));
  CertIssuerSourceAia aia_source(mock_fetcher);
  std::unique_ptr<CertIssuerSource::Request> cert_source_request;
  aia_source.AsyncGetIssuersOf(cert.get(), &cert_source_request);
  ASSERT_NE(nullptr, cert_source_request);
  ParsedCertificateList result_certs;
  cert_source_request->GetNext(&result_certs);
  EXPECT_TRUE(result_certs.empty());
}
TEST ( CertIssuerSourceAiaTest , FileAia ) { scoped_refptr < ParsedCertificate > cert ; ASSERT_TRUE ( ReadTestCert ( " " , & cert ) ) ; auto mock_fetcher = base :: MakeRefCounted < StrictMock < MockCertNetFetcher > > ( ) ; EXPECT_CALL ( * mock_fetcher , FetchCaIssuers ( GURL ( " " ) , _ , _ ) ) . WillOnce ( Return ( ByMove ( CreateMockRequest ( ERR_DISALLOWED_URL_SCHEME ) ) ) ) ; CertIssuerSourceAia aia_source ( mock_fetcher ) ; std :: unique_ptr < CertIssuerSource :: Request > cert_source_request ; aia_source . AsyncGetIssuersOf ( cert . get ( ) , & cert_source_request ) ; ASSERT_NE ( nullptr , cert_source_request ) ; ParsedCertificateList result_certs ; cert_source_request -> GetNext ( & result_certs ) ; EXPECT_TRUE ( result_certs . empty ( ) ) ; }
If the AuthorityInfoAccess extension only contains non-HTTP URIs,
AsyncGetIssuersOf should create a Request object.
If the AuthorityInfoAccess extension only contains non - HTTP URIs AsyncGetIssuersOf should create a Request object .
// No results.