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

Side by Side Diff: net/cert_net/cert_net_fetcher_impl_unittest.cc

Issue 2540543003: Un-disable CertNetFetcherImplTests on Android. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 "net/cert_net/cert_net_fetcher_impl.h" 5 #include "net/cert_net/cert_net_fetcher_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 }; 173 };
174 174
175 // Helper to start an AIA fetch using default parameters. 175 // Helper to start an AIA fetch using default parameters.
176 WARN_UNUSED_RESULT std::unique_ptr<CertNetFetcher::Request> StartRequest( 176 WARN_UNUSED_RESULT std::unique_ptr<CertNetFetcher::Request> StartRequest(
177 CertNetFetcher* fetcher, 177 CertNetFetcher* fetcher,
178 const GURL& url) { 178 const GURL& url) {
179 return fetcher->FetchCaIssuers(url, CertNetFetcher::DEFAULT, 179 return fetcher->FetchCaIssuers(url, CertNetFetcher::DEFAULT,
180 CertNetFetcher::DEFAULT); 180 CertNetFetcher::DEFAULT);
181 } 181 }
182 182
183 // Flaky on Android. See http://crbug.com/646147.
184 #if defined(OS_ANDROID)
185 #define MAYBE_ParallelFetchNoDuplicates DISABLED_ParallelFetchNoDuplicates
186 #else
187 #define MAYBE_ParallelFetchNoDuplicates ParallelFetchNoDuplicates
188 #endif
189 // Fetch a few unique URLs using GET in parallel. Each URL has a different body 183 // Fetch a few unique URLs using GET in parallel. Each URL has a different body
190 // and Content-Type. 184 // and Content-Type.
191 TEST_F(CertNetFetcherImplTest, MAYBE_ParallelFetchNoDuplicates) { 185 TEST_F(CertNetFetcherImplTest, ParallelFetchNoDuplicates) {
192 ASSERT_TRUE(test_server_.Start()); 186 ASSERT_TRUE(test_server_.Start());
193 187
194 auto fetcher = CreateFetcher(); 188 auto fetcher = CreateFetcher();
195 189
196 // Request a URL with Content-Type "application/pkix-cert" 190 // Request a URL with Content-Type "application/pkix-cert"
197 GURL url1 = test_server_.GetURL("/cert.crt"); 191 GURL url1 = test_server_.GetURL("/cert.crt");
198 std::unique_ptr<CertNetFetcher::Request> request1 = 192 std::unique_ptr<CertNetFetcher::Request> request1 =
199 StartRequest(fetcher.get(), url1); 193 StartRequest(fetcher.get(), url1);
200 194
201 // Request a URL with Content-Type "application/pkix-crl" 195 // Request a URL with Content-Type "application/pkix-crl"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 372
379 GURL url("https://foopy/foo.crt"); 373 GURL url("https://foopy/foo.crt");
380 std::unique_ptr<CertNetFetcher::Request> request = 374 std::unique_ptr<CertNetFetcher::Request> request =
381 StartRequest(fetcher.get(), url); 375 StartRequest(fetcher.get(), url);
382 376
383 // Cancel the request (May or may not have started yet, as the request is 377 // Cancel the request (May or may not have started yet, as the request is
384 // running on another thread). 378 // running on another thread).
385 request.reset(); 379 request.reset();
386 } 380 }
387 381
388 // Flaky on Android. See http://crbug.com/646147.
389 #if defined(OS_ANDROID)
390 #define MAYBE_CancelBeforeRunningMessageLoop \
391 DISABLED_CancelBeforeRunningMessageLoop
392 #else
393 #define MAYBE_CancelBeforeRunningMessageLoop CancelBeforeRunningMessageLoop
394 #endif
395 // Start a few requests, and cancel one of them before running the message loop 382 // Start a few requests, and cancel one of them before running the message loop
396 // again. 383 // again.
397 TEST_F(CertNetFetcherImplTest, MAYBE_CancelBeforeRunningMessageLoop) { 384 TEST_F(CertNetFetcherImplTest, CancelBeforeRunningMessageLoop) {
398 ASSERT_TRUE(test_server_.Start()); 385 ASSERT_TRUE(test_server_.Start());
399 386
400 auto fetcher = CreateFetcher(); 387 auto fetcher = CreateFetcher();
401 388
402 GURL url1 = test_server_.GetURL("/cert.crt"); 389 GURL url1 = test_server_.GetURL("/cert.crt");
403 std::unique_ptr<CertNetFetcher::Request> request1 = 390 std::unique_ptr<CertNetFetcher::Request> request1 =
404 StartRequest(fetcher.get(), url1); 391 StartRequest(fetcher.get(), url1);
405 392
406 GURL url2 = test_server_.GetURL("/root.crl"); 393 GURL url2 = test_server_.GetURL("/root.crl");
407 std::unique_ptr<CertNetFetcher::Request> request2 = 394 std::unique_ptr<CertNetFetcher::Request> request2 =
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // it doesn't even try to connect to the server). 443 // it doesn't even try to connect to the server).
457 VerifyFailure(ERR_DISALLOWED_URL_SCHEME, request3.get()); 444 VerifyFailure(ERR_DISALLOWED_URL_SCHEME, request3.get());
458 445
459 // Cancel the second outstanding request. 446 // Cancel the second outstanding request.
460 request2.reset(); 447 request2.reset();
461 448
462 // Wait for the first request to complete and verify the fetch result. 449 // Wait for the first request to complete and verify the fetch result.
463 VerifySuccess("-cert.crt-\n", request1.get()); 450 VerifySuccess("-cert.crt-\n", request1.get());
464 } 451 }
465 452
466 // Flaky on Android. See http://crbug.com/646147.
467 #if defined(OS_ANDROID)
468 #define MAYBE_ParallelFetchDuplicates DISABLED_ParallelFetchDuplicates
469 #else
470 #define MAYBE_ParallelFetchDuplicates ParallelFetchDuplicates
471 #endif
472 // Fetch the same URLs in parallel and verify that only 1 request is made per 453 // Fetch the same URLs in parallel and verify that only 1 request is made per
473 // URL. 454 // URL.
474 TEST_F(CertNetFetcherImplTest, MAYBE_ParallelFetchDuplicates) { 455 TEST_F(CertNetFetcherImplTest, ParallelFetchDuplicates) {
475 ASSERT_TRUE(test_server_.Start()); 456 ASSERT_TRUE(test_server_.Start());
476 457
477 auto fetcher = CreateFetcher(); 458 auto fetcher = CreateFetcher();
478 459
479 GURL url1 = test_server_.GetURL("/cert.crt"); 460 GURL url1 = test_server_.GetURL("/cert.crt");
480 GURL url2 = test_server_.GetURL("/root.crl"); 461 GURL url2 = test_server_.GetURL("/root.crl");
481 462
482 // Issue 3 requests for url1, and 3 requests for url2 463 // Issue 3 requests for url1, and 3 requests for url2
483 std::unique_ptr<CertNetFetcher::Request> request1 = 464 std::unique_ptr<CertNetFetcher::Request> request1 =
484 StartRequest(fetcher.get(), url1); 465 StartRequest(fetcher.get(), url1);
(...skipping 21 matching lines...) Expand all
506 VerifySuccess("-root.crl-\n", request2.get()); 487 VerifySuccess("-root.crl-\n", request2.get());
507 VerifySuccess("-root.crl-\n", request4.get()); 488 VerifySuccess("-root.crl-\n", request4.get());
508 VerifySuccess("-root.crl-\n", request5.get()); 489 VerifySuccess("-root.crl-\n", request5.get());
509 VerifySuccess("-cert.crt-\n", request6.get()); 490 VerifySuccess("-cert.crt-\n", request6.get());
510 491
511 // Verify that only 2 URLRequests were started even though 6 requests were 492 // Verify that only 2 URLRequests were started even though 6 requests were
512 // issued. 493 // issued.
513 EXPECT_EQ(2, NumCreatedRequests()); 494 EXPECT_EQ(2, NumCreatedRequests());
514 } 495 }
515 496
516 // Flaky on Android. See http://crbug.com/646147.
517 #if defined(OS_ANDROID)
518 #define MAYBE_CancelThenStart DISABLED_CancelThenStart
519 #else
520 #define MAYBE_CancelThenStart CancelThenStart
521 #endif
522 // Cancel a request and then start another one for the same URL. 497 // Cancel a request and then start another one for the same URL.
523 TEST_F(CertNetFetcherImplTest, MAYBE_CancelThenStart) { 498 TEST_F(CertNetFetcherImplTest, CancelThenStart) {
524 ASSERT_TRUE(test_server_.Start()); 499 ASSERT_TRUE(test_server_.Start());
525 500
526 auto fetcher = CreateFetcher(); 501 auto fetcher = CreateFetcher();
527 502
528 GURL url = test_server_.GetURL("/cert.crt"); 503 GURL url = test_server_.GetURL("/cert.crt");
529 504
530 std::unique_ptr<CertNetFetcher::Request> request1 = 505 std::unique_ptr<CertNetFetcher::Request> request1 =
531 StartRequest(fetcher.get(), url); 506 StartRequest(fetcher.get(), url);
532 request1.reset(); 507 request1.reset();
533 508
(...skipping 24 matching lines...) Expand all
558 // Cancel all the requests. 533 // Cancel all the requests.
559 for (size_t i = 0; i < arraysize(request); ++i) 534 for (size_t i = 0; i < arraysize(request); ++i)
560 request[i].reset(); 535 request[i].reset();
561 536
562 EXPECT_EQ(1, NumCreatedRequests()); 537 EXPECT_EQ(1, NumCreatedRequests());
563 } 538 }
564 539
565 } // namespace 540 } // namespace
566 541
567 } // namespace net 542 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698