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

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

Issue 2338713002: Disable CertNetFetcherImplTest tests on Android (Closed)
Patch Set: Created 4 years, 3 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
« 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 // Helper to start an AIA fetch using default parameters. 163 // Helper to start an AIA fetch using default parameters.
164 WARN_UNUSED_RESULT std::unique_ptr<CertNetFetcher::Request> StartRequest( 164 WARN_UNUSED_RESULT std::unique_ptr<CertNetFetcher::Request> StartRequest(
165 CertNetFetcher* fetcher, 165 CertNetFetcher* fetcher,
166 const GURL& url, 166 const GURL& url,
167 const TestFetchCallback& callback) { 167 const TestFetchCallback& callback) {
168 return fetcher->FetchCaIssuers(url, CertNetFetcher::DEFAULT, 168 return fetcher->FetchCaIssuers(url, CertNetFetcher::DEFAULT,
169 CertNetFetcher::DEFAULT, callback.callback()); 169 CertNetFetcher::DEFAULT, callback.callback());
170 } 170 }
171 171
172 // Flaky on Android. See http://crbug.com/646147.
173 #if defined(OS_ANDROID)
174 #define MAYBE_ParallelFetchNoDuplicates DISABLED_ParallelFetchNoDuplicates
175 #else
176 #define MAYBE_ParallelFetchNoDuplicates ParallelFetchNoDuplicates
177 #endif
172 // Fetch a few unique URLs using GET in parallel. Each URL has a different body 178 // Fetch a few unique URLs using GET in parallel. Each URL has a different body
173 // and Content-Type. 179 // and Content-Type.
174 TEST_F(CertNetFetcherImplTest, ParallelFetchNoDuplicates) { 180 TEST_F(CertNetFetcherImplTest, MAYBE_ParallelFetchNoDuplicates) {
175 ASSERT_TRUE(test_server_.Start()); 181 ASSERT_TRUE(test_server_.Start());
176 182
177 CertNetFetcherImpl fetcher(&context_); 183 CertNetFetcherImpl fetcher(&context_);
178 TestFetchCallback callback1; 184 TestFetchCallback callback1;
179 TestFetchCallback callback2; 185 TestFetchCallback callback2;
180 TestFetchCallback callback3; 186 TestFetchCallback callback3;
181 187
182 // Request a URL with Content-Type "application/pkix-cert" 188 // Request a URL with Content-Type "application/pkix-cert"
183 GURL url1 = test_server_.GetURL("/cert.crt"); 189 GURL url1 = test_server_.GetURL("/cert.crt");
184 std::unique_ptr<CertNetFetcher::Request> request1 = 190 std::unique_ptr<CertNetFetcher::Request> request1 =
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 // Spin the message loop to increase chance of catching a bug. 410 // Spin the message loop to increase chance of catching a bug.
405 base::RunLoop().RunUntilIdle(); 411 base::RunLoop().RunUntilIdle();
406 412
407 // Should NOT complete synchronously despite being a test that could be done 413 // Should NOT complete synchronously despite being a test that could be done
408 // immediately. 414 // immediately.
409 EXPECT_FALSE(callback.HasResult()); 415 EXPECT_FALSE(callback.HasResult());
410 416
411 EXPECT_EQ(0, network_delegate_.created_requests()); 417 EXPECT_EQ(0, network_delegate_.created_requests());
412 } 418 }
413 419
420 // Flaky on Android. See http://crbug.com/646147.
421 #if defined(OS_ANDROID)
422 #define MAYBE_CancelBeforeRunningMessageLoop \
423 DISABLED_CancelBeforeRunningMessageLoop
424 #else
425 #define MAYBE_CancelBeforeRunningMessageLoop CancelBeforeRunningMessageLoop
426 #endif
414 // Start a few requests, and cancel one of them before running the message loop 427 // Start a few requests, and cancel one of them before running the message loop
415 // again. 428 // again.
416 TEST_F(CertNetFetcherImplTest, CancelBeforeRunningMessageLoop) { 429 TEST_F(CertNetFetcherImplTest, MAYBE_CancelBeforeRunningMessageLoop) {
417 ASSERT_TRUE(test_server_.Start()); 430 ASSERT_TRUE(test_server_.Start());
418 431
419 CertNetFetcherImpl fetcher(&context_); 432 CertNetFetcherImpl fetcher(&context_);
420 TestFetchCallback callback1; 433 TestFetchCallback callback1;
421 TestFetchCallback callback2; 434 TestFetchCallback callback2;
422 TestFetchCallback callback3; 435 TestFetchCallback callback3;
423 436
424 GURL url1 = test_server_.GetURL("/cert.crt"); 437 GURL url1 = test_server_.GetURL("/cert.crt");
425 std::unique_ptr<CertNetFetcher::Request> request1 = 438 std::unique_ptr<CertNetFetcher::Request> request1 =
426 StartRequest(&fetcher, url1, callback1); 439 StartRequest(&fetcher, url1, callback1);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 527
515 GURL url(test_server_.GetURL("/slow/certs.p7c?20")); 528 GURL url(test_server_.GetURL("/slow/certs.p7c?20"));
516 TestFetchCallback callback; 529 TestFetchCallback callback;
517 std::unique_ptr<CertNetFetcher::Request> request = 530 std::unique_ptr<CertNetFetcher::Request> request =
518 StartRequest(fetcher.get(), url, callback); 531 StartRequest(fetcher.get(), url, callback);
519 532
520 // Destroy the fetcher before the outstanding request. 533 // Destroy the fetcher before the outstanding request.
521 fetcher.reset(); 534 fetcher.reset();
522 } 535 }
523 536
537 // Flaky on Android. See http://crbug.com/646147.
538 #if defined(OS_ANDROID)
539 #define MAYBE_ParallelFetchDuplicates DISABLED_ParallelFetchDuplicates
540 #else
541 #define MAYBE_ParallelFetchDuplicates ParallelFetchDuplicates
542 #endif
524 // Fetch the same URLs in parallel and verify that only 1 request is made per 543 // Fetch the same URLs in parallel and verify that only 1 request is made per
525 // URL. 544 // URL.
526 TEST_F(CertNetFetcherImplTest, ParallelFetchDuplicates) { 545 TEST_F(CertNetFetcherImplTest, MAYBE_ParallelFetchDuplicates) {
527 ASSERT_TRUE(test_server_.Start()); 546 ASSERT_TRUE(test_server_.Start());
528 547
529 CertNetFetcherImpl fetcher(&context_); 548 CertNetFetcherImpl fetcher(&context_);
530 549
531 GURL url1 = test_server_.GetURL("/cert.crt"); 550 GURL url1 = test_server_.GetURL("/cert.crt");
532 GURL url2 = test_server_.GetURL("/root.crl"); 551 GURL url2 = test_server_.GetURL("/root.crl");
533 552
534 // Issue 3 requests for url1, and 3 requests for url2 553 // Issue 3 requests for url1, and 3 requests for url2
535 TestFetchCallback callback1; 554 TestFetchCallback callback1;
536 std::unique_ptr<CertNetFetcher::Request> request1 = 555 std::unique_ptr<CertNetFetcher::Request> request1 =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 result2->VerifySuccess("-root.crl-\n"); 594 result2->VerifySuccess("-root.crl-\n");
576 result4->VerifySuccess("-root.crl-\n"); 595 result4->VerifySuccess("-root.crl-\n");
577 result5->VerifySuccess("-root.crl-\n"); 596 result5->VerifySuccess("-root.crl-\n");
578 result6->VerifySuccess("-cert.crt-\n"); 597 result6->VerifySuccess("-cert.crt-\n");
579 598
580 // Verify that only 2 URLRequests were started even though 6 requests were 599 // Verify that only 2 URLRequests were started even though 6 requests were
581 // issued. 600 // issued.
582 EXPECT_EQ(2, network_delegate_.created_requests()); 601 EXPECT_EQ(2, network_delegate_.created_requests());
583 } 602 }
584 603
604 // Flaky on Android. See http://crbug.com/646147.
605 #if defined(OS_ANDROID)
606 #define MAYBE_CancelThenStart DISABLED_CancelThenStart
607 #else
608 #define MAYBE_CancelThenStart CancelThenStart
609 #endif
585 // Cancel a request and then start another one for the same URL. 610 // Cancel a request and then start another one for the same URL.
586 TEST_F(CertNetFetcherImplTest, CancelThenStart) { 611 TEST_F(CertNetFetcherImplTest, MAYBE_CancelThenStart) {
587 ASSERT_TRUE(test_server_.Start()); 612 ASSERT_TRUE(test_server_.Start());
588 613
589 CertNetFetcherImpl fetcher(&context_); 614 CertNetFetcherImpl fetcher(&context_);
590 TestFetchCallback callback1; 615 TestFetchCallback callback1;
591 TestFetchCallback callback2; 616 TestFetchCallback callback2;
592 TestFetchCallback callback3; 617 TestFetchCallback callback3;
593 618
594 GURL url = test_server_.GetURL("/cert.crt"); 619 GURL url = test_server_.GetURL("/cert.crt");
595 620
596 std::unique_ptr<CertNetFetcher::Request> request1 = 621 std::unique_ptr<CertNetFetcher::Request> request1 =
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 EXPECT_FALSE(callback[3].HasResult()); 695 EXPECT_FALSE(callback[3].HasResult());
671 } 696 }
672 697
673 void FetchRequest(CertNetFetcher* fetcher, 698 void FetchRequest(CertNetFetcher* fetcher,
674 const GURL& url, 699 const GURL& url,
675 TestFetchCallback* callback, 700 TestFetchCallback* callback,
676 std::unique_ptr<CertNetFetcher::Request>* request) { 701 std::unique_ptr<CertNetFetcher::Request>* request) {
677 *request = StartRequest(fetcher, url, *callback); 702 *request = StartRequest(fetcher, url, *callback);
678 } 703 }
679 704
705 // Flaky on Android. See http://crbug.com/646147.
706 #if defined(OS_ANDROID)
707 #define MAYBE_FetchWithinCallback DISABLED_FetchWithinCallback
708 #else
709 #define MAYBE_FetchWithinCallback FetchWithinCallback
710 #endif
680 // Make a request during callback for the same URL. 711 // Make a request during callback for the same URL.
681 TEST_F(CertNetFetcherImplTest, FetchWithinCallback) { 712 TEST_F(CertNetFetcherImplTest, MAYBE_FetchWithinCallback) {
682 ASSERT_TRUE(test_server_.Start()); 713 ASSERT_TRUE(test_server_.Start());
683 714
684 CertNetFetcherImpl fetcher(&context_); 715 CertNetFetcherImpl fetcher(&context_);
685 716
686 GURL url = test_server_.GetURL("/cert.crt"); 717 GURL url = test_server_.GetURL("/cert.crt");
687 718
688 TestFetchCallback callback[5]; 719 TestFetchCallback callback[5];
689 std::unique_ptr<CertNetFetcher::Request> req[5]; 720 std::unique_ptr<CertNetFetcher::Request> req[5];
690 callback[1].set_extra_closure( 721 callback[1].set_extra_closure(
691 base::Bind(FetchRequest, &fetcher, url, &callback[4], &req[4])); 722 base::Bind(FetchRequest, &fetcher, url, &callback[4], &req[4]));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 continue; 764 continue;
734 765
735 std::unique_ptr<FetchResult> result = callback[i].WaitForResult(); 766 std::unique_ptr<FetchResult> result = callback[i].WaitForResult();
736 result->VerifySuccess("-cert.crt-\n"); 767 result->VerifySuccess("-cert.crt-\n");
737 } 768 }
738 769
739 // request[2] was cancelled. 770 // request[2] was cancelled.
740 EXPECT_FALSE(callback[2].HasResult()); 771 EXPECT_FALSE(callback[2].HasResult());
741 } 772 }
742 773
774 // Flaky on Android. See http://crbug.com/646147.
775 #if defined(OS_ANDROID)
776 #define MAYBE_CancelLastRequestWithinCallback \
777 DISABLED_CancelLastRequestWithinCallback
778 #else
779 #define MAYBE_CancelLastRequestWithinCallback CancelLastRequestWithinCallback
780 #endif
743 // Cancel the final request while executing a callback for the same job. Ensure 781 // Cancel the final request while executing a callback for the same job. Ensure
744 // that the job is not deleted twice. 782 // that the job is not deleted twice.
745 TEST_F(CertNetFetcherImplTest, CancelLastRequestWithinCallback) { 783 TEST_F(CertNetFetcherImplTest, MAYBE_CancelLastRequestWithinCallback) {
746 ASSERT_TRUE(test_server_.Start()); 784 ASSERT_TRUE(test_server_.Start());
747 785
748 CertNetFetcherImpl fetcher(&context_); 786 CertNetFetcherImpl fetcher(&context_);
749 787
750 GURL url = test_server_.GetURL("/cert.crt"); 788 GURL url = test_server_.GetURL("/cert.crt");
751 789
752 TestFetchCallback callback1; 790 TestFetchCallback callback1;
753 std::unique_ptr<CertNetFetcher::Request> request1 = 791 std::unique_ptr<CertNetFetcher::Request> request1 =
754 StartRequest(&fetcher, url, callback1); 792 StartRequest(&fetcher, url, callback1);
755 793
756 TestFetchCallback callback2; 794 TestFetchCallback callback2;
757 std::unique_ptr<CertNetFetcher::Request> request2 = 795 std::unique_ptr<CertNetFetcher::Request> request2 =
758 StartRequest(&fetcher, url, callback1); 796 StartRequest(&fetcher, url, callback1);
759 797
760 // Cancel request2 when the callback for request1 runs. 798 // Cancel request2 when the callback for request1 runs.
761 callback1.set_extra_closure(base::Bind(CancelRequest, &request2)); 799 callback1.set_extra_closure(base::Bind(CancelRequest, &request2));
762 800
763 EXPECT_EQ(1, network_delegate_.created_requests()); 801 EXPECT_EQ(1, network_delegate_.created_requests());
764 802
765 std::unique_ptr<FetchResult> result = callback1.WaitForResult(); 803 std::unique_ptr<FetchResult> result = callback1.WaitForResult();
766 result->VerifySuccess("-cert.crt-\n"); 804 result->VerifySuccess("-cert.crt-\n");
767 805
768 // request2 was cancelled. 806 // request2 was cancelled.
769 EXPECT_FALSE(callback2.HasResult()); 807 EXPECT_FALSE(callback2.HasResult());
770 } 808 }
771 809
772 } // namespace net 810 } // 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