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

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

Issue 1112513003: Put Data Reduction Proxy support in Cronet behind a gyp flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cronet
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 public void testDataReductionProxyEnabled() throws Exception { 106 public void testDataReductionProxyEnabled() throws Exception {
107 UrlRequestContextConfig config = new UrlRequestContextConfig(); 107 UrlRequestContextConfig config = new UrlRequestContextConfig();
108 config.setLibraryName("cronet_tests"); 108 config.setLibraryName("cronet_tests");
109 String[] commandLineArgs = { 109 String[] commandLineArgs = {
110 CronetTestActivity.CONFIG_KEY, config.toString() 110 CronetTestActivity.CONFIG_KEY, config.toString()
111 }; 111 };
112 mActivity = launchCronetTestAppWithUrlAndCommandLineArgs(null, 112 mActivity = launchCronetTestAppWithUrlAndCommandLineArgs(null,
113 commandLineArgs); 113 commandLineArgs);
114 assertTrue(NativeTestServer.startNativeTestServer( 114 assertTrue(NativeTestServer.startNativeTestServer(
115 getInstrumentation().getTargetContext())); 115 getInstrumentation().getTargetContext()));
116 116 if (!NativeTestServer.isDataReductionProxySupported()) {
117 return;
118 }
117 String serverHostPort = NativeTestServer.getHostPort(); 119 String serverHostPort = NativeTestServer.getHostPort();
118 // Shutdown the original context and create a new context that uses the 120 // Shutdown the original context and create a new context that uses the
119 // NativeTestServer as the data reduction proxy. 121 // NativeTestServer as the data reduction proxy.
120 mActivity.mUrlRequestContext.shutdown(); 122 mActivity.mUrlRequestContext.shutdown();
xunjieli 2015/05/14 14:24:10 The first context is useless right? Can we instead
bengr 2015/05/15 00:54:55 Fixed in a CL that landed recently.
121 UrlRequestContextConfig config2 = new UrlRequestContextConfig(); 123 UrlRequestContextConfig config2 = new UrlRequestContextConfig();
122 config2.enableDataReductionProxy("test-key"); 124 config2.enableDataReductionProxy("test-key");
123 config2.setDataReductionProxyOptions( 125 config2.setDataReductionProxyOptions(
124 serverHostPort, "unused.net:9999", 126 serverHostPort, "unused.net:9999",
125 NativeTestServer.getFileURL("/secureproxychecksuccess.txt")); 127 NativeTestServer.getFileURL("/secureproxychecksuccess.txt"));
126 config2.setLibraryName("cronet_tests"); 128 config2.setLibraryName("cronet_tests");
127 mActivity.mUrlRequestContext = 129 mActivity.mUrlRequestContext =
128 mActivity.mUrlRequestContext.createContext( 130 mActivity.mUrlRequestContext.createContext(
129 getInstrumentation().getTargetContext(), config2); 131 getInstrumentation().getTargetContext(), config2);
130 TestUrlRequestListener listener = new TestUrlRequestListener(); 132 TestUrlRequestListener listener = new TestUrlRequestListener();
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 new CronetUrlRequestContext(mActivity, mActivity.getContextConfi g()); 628 new CronetUrlRequestContext(mActivity, mActivity.getContextConfi g());
627 CronetUrlRequestContext secondContext = new CronetUrlRequestContext( 629 CronetUrlRequestContext secondContext = new CronetUrlRequestContext(
628 mActivity.getApplicationContext(), mActivity.getContextConfig()) ; 630 mActivity.getApplicationContext(), mActivity.getContextConfig()) ;
629 CronetUrlRequestContext thirdContext = new CronetUrlRequestContext( 631 CronetUrlRequestContext thirdContext = new CronetUrlRequestContext(
630 new ContextWrapper(mActivity), mActivity.getContextConfig()); 632 new ContextWrapper(mActivity), mActivity.getContextConfig());
631 firstContext.shutdown(); 633 firstContext.shutdown();
632 secondContext.shutdown(); 634 secondContext.shutdown();
633 thirdContext.shutdown(); 635 thirdContext.shutdown();
634 } 636 }
635 } 637 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698