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

Side by Side Diff: components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestContextTest.java

Issue 2528833002: [Cronet] Test via API not by manually constructing impl (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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 package org.chromium.net; 5 package org.chromium.net;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.ContextWrapper; 8 import android.content.ContextWrapper;
9 import android.os.ConditionVariable; 9 import android.os.ConditionVariable;
10 import android.os.Handler; 10 import android.os.Handler;
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 testFramework.mCronetEngine.shutdown(); 538 testFramework.mCronetEngine.shutdown();
539 } 539 }
540 540
541 @SmallTest 541 @SmallTest
542 @Feature({"Cronet"}) 542 @Feature({"Cronet"})
543 @OnlyRunNativeCronet // No netlogs for pure java impl 543 @OnlyRunNativeCronet // No netlogs for pure java impl
544 public void testNetLog() throws Exception { 544 public void testNetLog() throws Exception {
545 Context context = getContext(); 545 Context context = getContext();
546 File directory = new File(PathUtils.getDataDirectory()); 546 File directory = new File(PathUtils.getDataDirectory());
547 File file = File.createTempFile("cronet", "json", directory); 547 File file = File.createTempFile("cronet", "json", directory);
548 CronetEngine cronetEngine = 548 ExperimentalCronetEngine cronetEngine =
549 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) ); 549 new ExperimentalCronetEngine.Builder(context).build();
xunjieli 2016/11/28 00:30:53 Is there a reason that these are explicitly Experi
pauljensen 2016/11/28 12:56:44 Some of the tests use startNetLogToDisk which is e
550 // Start NetLog immediately after the request context is created to make 550 // Start NetLog immediately after the request context is created to make
551 // sure that the call won't crash the app even when the native request 551 // sure that the call won't crash the app even when the native request
552 // context is not fully initialized. See crbug.com/470196. 552 // context is not fully initialized. See crbug.com/470196.
553 cronetEngine.startNetLogToFile(file.getPath(), false); 553 cronetEngine.startNetLogToFile(file.getPath(), false);
554 554
555 // Start a request. 555 // Start a request.
556 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 556 TestUrlRequestCallback callback = new TestUrlRequestCallback();
557 UrlRequest.Builder urlRequestBuilder = 557 UrlRequest.Builder urlRequestBuilder =
558 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor()); 558 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor());
559 urlRequestBuilder.build().start(); 559 urlRequestBuilder.build().start();
560 callback.blockForDone(); 560 callback.blockForDone();
561 cronetEngine.stopNetLog(); 561 cronetEngine.stopNetLog();
562 assertTrue(file.exists()); 562 assertTrue(file.exists());
563 assertTrue(file.length() != 0); 563 assertTrue(file.length() != 0);
564 assertFalse(hasBytesInNetLog(file)); 564 assertFalse(hasBytesInNetLog(file));
565 assertTrue(file.delete()); 565 assertTrue(file.delete());
566 assertTrue(!file.exists()); 566 assertTrue(!file.exists());
567 } 567 }
568 568
569 @SmallTest 569 @SmallTest
570 @Feature({"Cronet"}) 570 @Feature({"Cronet"})
571 @OnlyRunNativeCronet // No netlogs for pure java impl 571 @OnlyRunNativeCronet // No netlogs for pure java impl
572 public void testBoundedFileNetLog() throws Exception { 572 public void testBoundedFileNetLog() throws Exception {
573 Context context = getContext(); 573 Context context = getContext();
574 File directory = new File(PathUtils.getDataDirectory()); 574 File directory = new File(PathUtils.getDataDirectory());
575 File netLogDir = new File(directory, "NetLog"); 575 File netLogDir = new File(directory, "NetLog");
576 assertFalse(netLogDir.exists()); 576 assertFalse(netLogDir.exists());
577 assertTrue(netLogDir.mkdir()); 577 assertTrue(netLogDir.mkdir());
578 File eventFile = new File(netLogDir, "event_file_0.json"); 578 File eventFile = new File(netLogDir, "event_file_0.json");
579 CronetUrlRequestContext cronetEngine = 579 ExperimentalCronetEngine cronetEngine =
580 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) ); 580 new ExperimentalCronetEngine.Builder(context).build();
581 // Start NetLog immediately after the request context is created to make 581 // Start NetLog immediately after the request context is created to make
582 // sure that the call won't crash the app even when the native request 582 // sure that the call won't crash the app even when the native request
583 // context is not fully initialized. See crbug.com/470196. 583 // context is not fully initialized. See crbug.com/470196.
584 cronetEngine.startNetLogToDisk(netLogDir.getPath(), false, MAX_FILE_SIZE ); 584 cronetEngine.startNetLogToDisk(netLogDir.getPath(), false, MAX_FILE_SIZE );
585 585
586 // Start a request. 586 // Start a request.
587 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 587 TestUrlRequestCallback callback = new TestUrlRequestCallback();
588 UrlRequest.Builder urlRequestBuilder = 588 UrlRequest.Builder urlRequestBuilder =
589 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor()); 589 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor());
590 urlRequestBuilder.build().start(); 590 urlRequestBuilder.build().start();
591 callback.blockForDone(); 591 callback.blockForDone();
592 cronetEngine.stopNetLog(); 592 cronetEngine.stopNetLog();
593 assertTrue(eventFile.exists()); 593 assertTrue(eventFile.exists());
594 assertTrue(eventFile.length() != 0); 594 assertTrue(eventFile.length() != 0);
595 assertFalse(hasBytesInNetLog(eventFile)); 595 assertFalse(hasBytesInNetLog(eventFile));
596 FileUtils.recursivelyDeleteFile(netLogDir); 596 FileUtils.recursivelyDeleteFile(netLogDir);
597 assertFalse(netLogDir.exists()); 597 assertFalse(netLogDir.exists());
598 } 598 }
599 599
600 @SmallTest 600 @SmallTest
601 @Feature({"Cronet"}) 601 @Feature({"Cronet"})
602 @OnlyRunNativeCronet // No netlogs for pure java impl 602 @OnlyRunNativeCronet // No netlogs for pure java impl
603 // Tests that if stopNetLog is not explicity called, CronetEngine.shutdown() 603 // Tests that if stopNetLog is not explicity called, CronetEngine.shutdown()
604 // will take care of it. crbug.com/623701. 604 // will take care of it. crbug.com/623701.
605 public void testNoStopNetLog() throws Exception { 605 public void testNoStopNetLog() throws Exception {
606 Context context = getContext(); 606 Context context = getContext();
607 File directory = new File(PathUtils.getDataDirectory()); 607 File directory = new File(PathUtils.getDataDirectory());
608 File file = File.createTempFile("cronet", "json", directory); 608 File file = File.createTempFile("cronet", "json", directory);
609 CronetUrlRequestContext cronetEngine = 609 ExperimentalCronetEngine cronetEngine =
610 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) ); 610 new ExperimentalCronetEngine.Builder(context).build();
611 cronetEngine.startNetLogToFile(file.getPath(), false); 611 cronetEngine.startNetLogToFile(file.getPath(), false);
612 612
613 // Start a request. 613 // Start a request.
614 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 614 TestUrlRequestCallback callback = new TestUrlRequestCallback();
615 UrlRequest.Builder urlRequestBuilder = 615 UrlRequest.Builder urlRequestBuilder =
616 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor()); 616 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor());
617 urlRequestBuilder.build().start(); 617 urlRequestBuilder.build().start();
618 callback.blockForDone(); 618 callback.blockForDone();
619 // Shut down the engine without calling stopNetLog. 619 // Shut down the engine without calling stopNetLog.
620 cronetEngine.shutdown(); 620 cronetEngine.shutdown();
621 assertTrue(file.exists()); 621 assertTrue(file.exists());
622 assertTrue(file.length() != 0); 622 assertTrue(file.length() != 0);
623 assertFalse(hasBytesInNetLog(file)); 623 assertFalse(hasBytesInNetLog(file));
624 assertTrue(file.delete()); 624 assertTrue(file.delete());
625 assertTrue(!file.exists()); 625 assertTrue(!file.exists());
626 } 626 }
627 627
628 @SmallTest 628 @SmallTest
629 @Feature({"Cronet"}) 629 @Feature({"Cronet"})
630 @OnlyRunNativeCronet // No netlogs for pure java impl 630 @OnlyRunNativeCronet // No netlogs for pure java impl
631 // Tests that if stopNetLog is not explicity called, CronetEngine.shutdown() 631 // Tests that if stopNetLog is not explicity called, CronetEngine.shutdown()
632 // will take care of it. crbug.com/623701. 632 // will take care of it. crbug.com/623701.
633 public void testNoStopBoundedFileNetLog() throws Exception { 633 public void testNoStopBoundedFileNetLog() throws Exception {
634 Context context = getContext(); 634 Context context = getContext();
635 File directory = new File(PathUtils.getDataDirectory()); 635 File directory = new File(PathUtils.getDataDirectory());
636 File netLogDir = new File(directory, "NetLog"); 636 File netLogDir = new File(directory, "NetLog");
637 assertFalse(netLogDir.exists()); 637 assertFalse(netLogDir.exists());
638 assertTrue(netLogDir.mkdir()); 638 assertTrue(netLogDir.mkdir());
639 File eventFile = new File(netLogDir, "event_file_0.json"); 639 File eventFile = new File(netLogDir, "event_file_0.json");
640 CronetUrlRequestContext cronetEngine = 640 ExperimentalCronetEngine cronetEngine =
641 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) ); 641 new ExperimentalCronetEngine.Builder(context).build();
642 cronetEngine.startNetLogToDisk(netLogDir.getPath(), false, MAX_FILE_SIZE ); 642 cronetEngine.startNetLogToDisk(netLogDir.getPath(), false, MAX_FILE_SIZE );
643 643
644 // Start a request. 644 // Start a request.
645 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 645 TestUrlRequestCallback callback = new TestUrlRequestCallback();
646 UrlRequest.Builder urlRequestBuilder = 646 UrlRequest.Builder urlRequestBuilder =
647 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor()); 647 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor());
648 urlRequestBuilder.build().start(); 648 urlRequestBuilder.build().start();
649 callback.blockForDone(); 649 callback.blockForDone();
650 // Shut down the engine without calling stopNetLog. 650 // Shut down the engine without calling stopNetLog.
651 cronetEngine.shutdown(); 651 cronetEngine.shutdown();
652 assertTrue(eventFile.exists()); 652 assertTrue(eventFile.exists());
653 assertTrue(eventFile.length() != 0); 653 assertTrue(eventFile.length() != 0);
654 654
655 FileUtils.recursivelyDeleteFile(netLogDir); 655 FileUtils.recursivelyDeleteFile(netLogDir);
656 assertFalse(netLogDir.exists()); 656 assertFalse(netLogDir.exists());
657 } 657 }
658 658
659 @SmallTest 659 @SmallTest
660 @Feature({"Cronet"}) 660 @Feature({"Cronet"})
661 @OnlyRunNativeCronet 661 @OnlyRunNativeCronet
662 // Tests that NetLog contains events emitted by all live CronetEngines. 662 // Tests that NetLog contains events emitted by all live CronetEngines.
663 public void testNetLogContainEventsFromAllLiveEngines() throws Exception { 663 public void testNetLogContainEventsFromAllLiveEngines() throws Exception {
664 Context context = getContext(); 664 Context context = getContext();
665 File directory = new File(PathUtils.getDataDirectory()); 665 File directory = new File(PathUtils.getDataDirectory());
666 File file1 = File.createTempFile("cronet1", "json", directory); 666 File file1 = File.createTempFile("cronet1", "json", directory);
667 File file2 = File.createTempFile("cronet2", "json", directory); 667 File file2 = File.createTempFile("cronet2", "json", directory);
668 CronetEngine cronetEngine1 = 668 ExperimentalCronetEngine cronetEngine1 =
669 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) ); 669 new ExperimentalCronetEngine.Builder(context).build();
670 CronetEngine cronetEngine2 = 670 ExperimentalCronetEngine cronetEngine2 =
671 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) ); 671 new ExperimentalCronetEngine.Builder(context).build();
672 672
673 cronetEngine1.startNetLogToFile(file1.getPath(), false); 673 cronetEngine1.startNetLogToFile(file1.getPath(), false);
674 cronetEngine2.startNetLogToFile(file2.getPath(), false); 674 cronetEngine2.startNetLogToFile(file2.getPath(), false);
675 675
676 // Warm CronetEngine and make sure both CronetUrlRequestContexts are 676 // Warm CronetEngine and make sure both CronetUrlRequestContexts are
677 // initialized before testing the logs. 677 // initialized before testing the logs.
678 makeRequestAndCheckStatus(cronetEngine1, mUrl, 200); 678 makeRequestAndCheckStatus(cronetEngine1, mUrl, 200);
679 makeRequestAndCheckStatus(cronetEngine2, mUrl, 200); 679 makeRequestAndCheckStatus(cronetEngine2, mUrl, 200);
680 680
681 // Use cronetEngine1 to make a request to mUrl404. 681 // Use cronetEngine1 to make a request to mUrl404.
(...skipping 25 matching lines...) Expand all
707 File directory = new File(PathUtils.getDataDirectory()); 707 File directory = new File(PathUtils.getDataDirectory());
708 File netLogDir1 = new File(directory, "NetLog1"); 708 File netLogDir1 = new File(directory, "NetLog1");
709 assertFalse(netLogDir1.exists()); 709 assertFalse(netLogDir1.exists());
710 assertTrue(netLogDir1.mkdir()); 710 assertTrue(netLogDir1.mkdir());
711 File netLogDir2 = new File(directory, "NetLog2"); 711 File netLogDir2 = new File(directory, "NetLog2");
712 assertFalse(netLogDir2.exists()); 712 assertFalse(netLogDir2.exists());
713 assertTrue(netLogDir2.mkdir()); 713 assertTrue(netLogDir2.mkdir());
714 File eventFile1 = new File(netLogDir1, "event_file_0.json"); 714 File eventFile1 = new File(netLogDir1, "event_file_0.json");
715 File eventFile2 = new File(netLogDir2, "event_file_0.json"); 715 File eventFile2 = new File(netLogDir2, "event_file_0.json");
716 716
717 CronetUrlRequestContext cronetEngine1 = 717 ExperimentalCronetEngine cronetEngine1 =
718 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) ); 718 new ExperimentalCronetEngine.Builder(context).build();
719 CronetUrlRequestContext cronetEngine2 = 719 ExperimentalCronetEngine cronetEngine2 =
720 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) ); 720 new ExperimentalCronetEngine.Builder(context).build();
721 721
722 cronetEngine1.startNetLogToDisk(netLogDir1.getPath(), false, MAX_FILE_SI ZE); 722 cronetEngine1.startNetLogToDisk(netLogDir1.getPath(), false, MAX_FILE_SI ZE);
723 cronetEngine2.startNetLogToDisk(netLogDir2.getPath(), false, MAX_FILE_SI ZE); 723 cronetEngine2.startNetLogToDisk(netLogDir2.getPath(), false, MAX_FILE_SI ZE);
724 724
725 // Warm CronetEngine and make sure both CronetUrlRequestContexts are 725 // Warm CronetEngine and make sure both CronetUrlRequestContexts are
726 // initialized before testing the logs. 726 // initialized before testing the logs.
727 makeRequestAndCheckStatus(cronetEngine1, mUrl, 200); 727 makeRequestAndCheckStatus(cronetEngine1, mUrl, 200);
728 makeRequestAndCheckStatus(cronetEngine2, mUrl, 200); 728 makeRequestAndCheckStatus(cronetEngine2, mUrl, 200);
729 729
730 // Use cronetEngine1 to make a request to mUrl404. 730 // Use cronetEngine1 to make a request to mUrl404.
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 assertFalse(netLogDir.exists()); 1020 assertFalse(netLogDir.exists());
1021 } 1021 }
1022 1022
1023 @SmallTest 1023 @SmallTest
1024 @Feature({"Cronet"}) 1024 @Feature({"Cronet"})
1025 @OnlyRunNativeCronet 1025 @OnlyRunNativeCronet
1026 public void testNetLogWithBytes() throws Exception { 1026 public void testNetLogWithBytes() throws Exception {
1027 Context context = getContext(); 1027 Context context = getContext();
1028 File directory = new File(PathUtils.getDataDirectory()); 1028 File directory = new File(PathUtils.getDataDirectory());
1029 File file = File.createTempFile("cronet", "json", directory); 1029 File file = File.createTempFile("cronet", "json", directory);
1030 CronetEngine cronetEngine = 1030 CronetEngine cronetEngine = new CronetEngine.Builder(context).build();
1031 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) );
1032 // Start NetLog with logAll as true. 1031 // Start NetLog with logAll as true.
1033 cronetEngine.startNetLogToFile(file.getPath(), true); 1032 cronetEngine.startNetLogToFile(file.getPath(), true);
1034 // Start a request. 1033 // Start a request.
1035 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 1034 TestUrlRequestCallback callback = new TestUrlRequestCallback();
1036 UrlRequest.Builder urlRequestBuilder = 1035 UrlRequest.Builder urlRequestBuilder =
1037 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor()); 1036 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor());
1038 urlRequestBuilder.build().start(); 1037 urlRequestBuilder.build().start();
1039 callback.blockForDone(); 1038 callback.blockForDone();
1040 cronetEngine.stopNetLog(); 1039 cronetEngine.stopNetLog();
1041 assertTrue(file.exists()); 1040 assertTrue(file.exists());
1042 assertTrue(file.length() != 0); 1041 assertTrue(file.length() != 0);
1043 assertTrue(hasBytesInNetLog(file)); 1042 assertTrue(hasBytesInNetLog(file));
1044 assertTrue(file.delete()); 1043 assertTrue(file.delete());
1045 assertTrue(!file.exists()); 1044 assertTrue(!file.exists());
1046 } 1045 }
1047 1046
1048 @SmallTest 1047 @SmallTest
1049 @Feature({"Cronet"}) 1048 @Feature({"Cronet"})
1050 @OnlyRunNativeCronet 1049 @OnlyRunNativeCronet
1051 public void testBoundedFileNetLogWithBytes() throws Exception { 1050 public void testBoundedFileNetLogWithBytes() throws Exception {
1052 Context context = getContext(); 1051 Context context = getContext();
1053 File directory = new File(PathUtils.getDataDirectory()); 1052 File directory = new File(PathUtils.getDataDirectory());
1054 File netLogDir = new File(directory, "NetLog"); 1053 File netLogDir = new File(directory, "NetLog");
1055 assertFalse(netLogDir.exists()); 1054 assertFalse(netLogDir.exists());
1056 assertTrue(netLogDir.mkdir()); 1055 assertTrue(netLogDir.mkdir());
1057 File eventFile = new File(netLogDir, "event_file_0.json"); 1056 File eventFile = new File(netLogDir, "event_file_0.json");
1058 CronetUrlRequestContext cronetEngine = 1057 ExperimentalCronetEngine cronetEngine =
1059 new CronetUrlRequestContext(new CronetEngineBuilderImpl(context) ); 1058 new ExperimentalCronetEngine.Builder(context).build();
1060 // Start NetLog with logAll as true. 1059 // Start NetLog with logAll as true.
1061 cronetEngine.startNetLogToDisk(netLogDir.getPath(), true, MAX_FILE_SIZE) ; 1060 cronetEngine.startNetLogToDisk(netLogDir.getPath(), true, MAX_FILE_SIZE) ;
1062 // Start a request. 1061 // Start a request.
1063 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 1062 TestUrlRequestCallback callback = new TestUrlRequestCallback();
1064 UrlRequest.Builder urlRequestBuilder = 1063 UrlRequest.Builder urlRequestBuilder =
1065 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor()); 1064 cronetEngine.newUrlRequestBuilder(mUrl, callback, callback.getEx ecutor());
1066 urlRequestBuilder.build().start(); 1065 urlRequestBuilder.build().start();
1067 callback.blockForDone(); 1066 callback.blockForDone();
1068 cronetEngine.stopNetLog(); 1067 cronetEngine.stopNetLog();
1069 1068
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 assertEquals(200, thread1.mCallback.mResponseInfo.getHttpStatusCode()); 1334 assertEquals(200, thread1.mCallback.mResponseInfo.getHttpStatusCode());
1336 assertEquals(404, thread2.mCallback.mResponseInfo.getHttpStatusCode()); 1335 assertEquals(404, thread2.mCallback.mResponseInfo.getHttpStatusCode());
1337 } 1336 }
1338 1337
1339 @SmallTest 1338 @SmallTest
1340 @Feature({"Cronet"}) 1339 @Feature({"Cronet"})
1341 public void testInitDifferentEngines() throws Exception { 1340 public void testInitDifferentEngines() throws Exception {
1342 // Test that concurrently instantiating Cronet context's upon various 1341 // Test that concurrently instantiating Cronet context's upon various
1343 // different versions of the same Android Context does not cause crashes 1342 // different versions of the same Android Context does not cause crashes
1344 // like crbug.com/453845 1343 // like crbug.com/453845
1345 final CronetTestFramework testFramework = startCronetTestFramework(); 1344 CronetEngine firstEngine = new CronetEngine.Builder(getContext()).build( );
1346 CronetEngine firstEngine = 1345 CronetEngine secondEngine =
1347 new CronetUrlRequestContext(CronetTestUtil.getCronetEngineBuilde rImpl( 1346 new CronetEngine.Builder(getContext().getApplicationContext()).b uild();
1348 testFramework.createCronetEngineBuilder(getContext())));
1349 CronetEngine secondEngine = new CronetUrlRequestContext(
1350 CronetTestUtil.getCronetEngineBuilderImpl(testFramework.createCr onetEngineBuilder(
1351 getContext().getApplicationContext())));
1352 CronetEngine thirdEngine = 1347 CronetEngine thirdEngine =
1353 new CronetUrlRequestContext(CronetTestUtil.getCronetEngineBuilde rImpl( 1348 new CronetEngine.Builder(new ContextWrapper(getContext())).build ();
1354 testFramework.createCronetEngineBuilder(new ContextWrapp er(getContext()))));
1355 firstEngine.shutdown(); 1349 firstEngine.shutdown();
1356 secondEngine.shutdown(); 1350 secondEngine.shutdown();
1357 thirdEngine.shutdown(); 1351 thirdEngine.shutdown();
1358 } 1352 }
1359 1353
1360 @SmallTest 1354 @SmallTest
1361 @Feature({"Cronet"}) 1355 @Feature({"Cronet"})
1362 public void testGetGlobalMetricsDeltas() throws Exception { 1356 public void testGetGlobalMetricsDeltas() throws Exception {
1363 final CronetTestFramework testFramework = startCronetTestFramework(); 1357 final CronetTestFramework testFramework = startCronetTestFramework();
1364 1358
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 TestUrlRequestCallback callback = new TestUrlRequestCallback(); 1470 TestUrlRequestCallback callback = new TestUrlRequestCallback();
1477 URL requestUrl = 1471 URL requestUrl =
1478 new URL("http", resolverTestHostname, testUrl.getPort(), testUrl .getFile()); 1472 new URL("http", resolverTestHostname, testUrl.getPort(), testUrl .getFile());
1479 UrlRequest.Builder urlRequestBuilder = testFramework.mCronetEngine.newUr lRequestBuilder( 1473 UrlRequest.Builder urlRequestBuilder = testFramework.mCronetEngine.newUr lRequestBuilder(
1480 requestUrl.toString(), callback, callback.getExecutor()); 1474 requestUrl.toString(), callback, callback.getExecutor());
1481 urlRequestBuilder.build().start(); 1475 urlRequestBuilder.build().start();
1482 callback.blockForDone(); 1476 callback.blockForDone();
1483 assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); 1477 assertEquals(200, callback.mResponseInfo.getHttpStatusCode());
1484 } 1478 }
1485 } 1479 }
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