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

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

Issue 1143503005: Fix Data Saver test in Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698