| OLD | NEW |
| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 mActivity = launchCronetTestAppAndSkipFactoryInit(); | 109 mActivity = launchCronetTestAppAndSkipFactoryInit(); |
| 110 | 110 |
| 111 // Ensure native code is loaded before trying to start test server. | 111 // Ensure native code is loaded before trying to start test server. |
| 112 UrlRequestContext.createContext( | 112 UrlRequestContext.createContext( |
| 113 getInstrumentation().getTargetContext(), | 113 getInstrumentation().getTargetContext(), |
| 114 new UrlRequestContextConfig().setLibraryName("cronet_tests")) | 114 new UrlRequestContextConfig().setLibraryName("cronet_tests")) |
| 115 .shutdown(); | 115 .shutdown(); |
| 116 | 116 |
| 117 assertTrue(NativeTestServer.startNativeTestServer( | 117 assertTrue(NativeTestServer.startNativeTestServer( |
| 118 getInstrumentation().getTargetContext())); | 118 getInstrumentation().getTargetContext())); |
| 119 | 119 if (!NativeTestServer.isDataReductionProxySupported()) { |
| 120 return; |
| 121 } |
| 120 String serverHostPort = NativeTestServer.getHostPort(); | 122 String serverHostPort = NativeTestServer.getHostPort(); |
| 121 | 123 |
| 122 // Enable the Data Reduction Proxy and configure it to use the test | 124 // Enable the Data Reduction Proxy and configure it to use the test |
| 123 // server as its primary proxy, and to check successfully that this | 125 // server as its primary proxy, and to check successfully that this |
| 124 // proxy is OK to use. | 126 // proxy is OK to use. |
| 125 UrlRequestContextConfig config = new UrlRequestContextConfig(); | 127 UrlRequestContextConfig config = new UrlRequestContextConfig(); |
| 126 config.enableDataReductionProxy("test-key"); | 128 config.enableDataReductionProxy("test-key"); |
| 127 config.setDataReductionProxyOptions( | 129 config.setDataReductionProxyOptions( |
| 128 serverHostPort, "unused.net:9999", | 130 serverHostPort, "unused.net:9999", |
| 129 NativeTestServer.getFileURL("/secureproxychecksuccess.txt")); | 131 NativeTestServer.getFileURL("/secureproxychecksuccess.txt")); |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 new CronetUrlRequestContext(mActivity, mActivity.getContextConfi
g()); | 669 new CronetUrlRequestContext(mActivity, mActivity.getContextConfi
g()); |
| 668 CronetUrlRequestContext secondContext = new CronetUrlRequestContext( | 670 CronetUrlRequestContext secondContext = new CronetUrlRequestContext( |
| 669 mActivity.getApplicationContext(), mActivity.getContextConfig())
; | 671 mActivity.getApplicationContext(), mActivity.getContextConfig())
; |
| 670 CronetUrlRequestContext thirdContext = new CronetUrlRequestContext( | 672 CronetUrlRequestContext thirdContext = new CronetUrlRequestContext( |
| 671 new ContextWrapper(mActivity), mActivity.getContextConfig()); | 673 new ContextWrapper(mActivity), mActivity.getContextConfig()); |
| 672 firstContext.shutdown(); | 674 firstContext.shutdown(); |
| 673 secondContext.shutdown(); | 675 secondContext.shutdown(); |
| 674 thirdContext.shutdown(); | 676 thirdContext.shutdown(); |
| 675 } | 677 } |
| 676 } | 678 } |
| OLD | NEW |