Chromium Code Reviews| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 config.setLibraryName("cronet_tests"); | 132 config.setLibraryName("cronet_tests"); |
| 133 mActivity.mUrlRequestContext = | 133 mActivity.mUrlRequestContext = |
| 134 mActivity.mUrlRequestContext.createContext( | 134 mActivity.mUrlRequestContext.createContext( |
| 135 getInstrumentation().getTargetContext(), config); | 135 getInstrumentation().getTargetContext(), config); |
| 136 TestUrlRequestListener listener = new TestUrlRequestListener(); | 136 TestUrlRequestListener listener = new TestUrlRequestListener(); |
| 137 | 137 |
| 138 // Construct and start a request that can only be returned by the test | 138 // Construct and start a request that can only be returned by the test |
| 139 // server. This request will fail if the configuration logic for the | 139 // server. This request will fail if the configuration logic for the |
| 140 // Data Reduction Proxy is not used. | 140 // Data Reduction Proxy is not used. |
| 141 UrlRequest urlRequest = mActivity.mUrlRequestContext.createRequest( | 141 UrlRequest urlRequest = mActivity.mUrlRequestContext.createRequest( |
| 142 "http://google.com/datareductionproxysuccess.txt", | 142 "http://eivnwoeivnowenv.com/datareductionproxysuccess.txt", |
|
mmenke
2015/05/15 15:37:46
Can we just use http://DomainThatDoesntResolve/ ?
bengr
2015/05/15 19:30:21
That doesn't work, but http://DomainThatDoesnt.Res
mmenke
2015/05/15 19:32:31
Hrm...Weird. Wonder if it's a net issue or a DRP
| |
| 143 listener, listener.getExecutor()); | 143 listener, listener.getExecutor()); |
| 144 urlRequest.start(); | 144 urlRequest.start(); |
| 145 listener.blockForDone(); | 145 listener.blockForDone(); |
| 146 | 146 |
| 147 // Verify that the request is successful and that the Data Reduction | 147 // Verify that the request is successful and that the Data Reduction |
| 148 // Proxy logic configured to use the test server as its proxy. | 148 // Proxy logic configured to use the test server as its proxy. |
| 149 assertEquals(200, listener.mResponseInfo.getHttpStatusCode()); | 149 assertEquals(200, listener.mResponseInfo.getHttpStatusCode()); |
| 150 assertEquals(serverHostPort, listener.mResponseInfo.getProxyServer()); | 150 assertEquals(serverHostPort, listener.mResponseInfo.getProxyServer()); |
| 151 assertEquals("http://www.google.com/datareductionproxysuccess.txt", | 151 assertEquals("http://eivnwoeivnowenv.com/datareductionproxysuccess.txt", |
| 152 listener.mResponseInfo.getUrl()); | 152 listener.mResponseInfo.getUrl()); |
| 153 } | 153 } |
| 154 | 154 |
| 155 @SmallTest | 155 @SmallTest |
| 156 @Feature({"Cronet"}) | 156 @Feature({"Cronet"}) |
| 157 public void testShutdown() throws Exception { | 157 public void testShutdown() throws Exception { |
| 158 mActivity = launchCronetTestApp(); | 158 mActivity = launchCronetTestApp(); |
| 159 TestUrlRequestListener listener = new ShutdownTestUrlRequestListener(); | 159 TestUrlRequestListener listener = new ShutdownTestUrlRequestListener(); |
| 160 // Block listener when response starts to verify that shutdown fails | 160 // Block listener when response starts to verify that shutdown fails |
| 161 // if there are active requests. | 161 // if there are active requests. |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 new CronetUrlRequestContext(mActivity, mActivity.getContextConfi g()); | 669 new CronetUrlRequestContext(mActivity, mActivity.getContextConfi g()); |
| 670 CronetUrlRequestContext secondContext = new CronetUrlRequestContext( | 670 CronetUrlRequestContext secondContext = new CronetUrlRequestContext( |
| 671 mActivity.getApplicationContext(), mActivity.getContextConfig()) ; | 671 mActivity.getApplicationContext(), mActivity.getContextConfig()) ; |
| 672 CronetUrlRequestContext thirdContext = new CronetUrlRequestContext( | 672 CronetUrlRequestContext thirdContext = new CronetUrlRequestContext( |
| 673 new ContextWrapper(mActivity), mActivity.getContextConfig()); | 673 new ContextWrapper(mActivity), mActivity.getContextConfig()); |
| 674 firstContext.shutdown(); | 674 firstContext.shutdown(); |
| 675 secondContext.shutdown(); | 675 secondContext.shutdown(); |
| 676 thirdContext.shutdown(); | 676 thirdContext.shutdown(); |
| 677 } | 677 } |
| 678 } | 678 } |
| OLD | NEW |