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

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: rebase 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
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc » ('j') | 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 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://DomainThatDoesnt.Resolve/datareductionproxysuccess.txt",
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(
152 "http://DomainThatDoesnt.Resolve/datareductionproxysuccess.txt",
152 listener.mResponseInfo.getUrl()); 153 listener.mResponseInfo.getUrl());
153 } 154 }
154 155
155 @SmallTest 156 @SmallTest
156 @Feature({"Cronet"}) 157 @Feature({"Cronet"})
157 public void testShutdown() throws Exception { 158 public void testShutdown() throws Exception {
158 mActivity = launchCronetTestApp(); 159 mActivity = launchCronetTestApp();
159 TestUrlRequestListener listener = new ShutdownTestUrlRequestListener(); 160 TestUrlRequestListener listener = new ShutdownTestUrlRequestListener();
160 // Block listener when response starts to verify that shutdown fails 161 // Block listener when response starts to verify that shutdown fails
161 // if there are active requests. 162 // if there are active requests.
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 new CronetUrlRequestContext(mActivity, mActivity.getContextConfi g()); 670 new CronetUrlRequestContext(mActivity, mActivity.getContextConfi g());
670 CronetUrlRequestContext secondContext = new CronetUrlRequestContext( 671 CronetUrlRequestContext secondContext = new CronetUrlRequestContext(
671 mActivity.getApplicationContext(), mActivity.getContextConfig()) ; 672 mActivity.getApplicationContext(), mActivity.getContextConfig()) ;
672 CronetUrlRequestContext thirdContext = new CronetUrlRequestContext( 673 CronetUrlRequestContext thirdContext = new CronetUrlRequestContext(
673 new ContextWrapper(mActivity), mActivity.getContextConfig()); 674 new ContextWrapper(mActivity), mActivity.getContextConfig());
674 firstContext.shutdown(); 675 firstContext.shutdown();
675 secondContext.shutdown(); 676 secondContext.shutdown();
676 thirdContext.shutdown(); 677 thirdContext.shutdown();
677 } 678 }
678 } 679 }
OLDNEW
« no previous file with comments | « no previous file | components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698