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

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

Issue 1492583002: Add HttpUrlConnection backed implementation of CronetEngine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 5 years 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.test.suitebuilder.annotation.SmallTest; 8 import android.test.suitebuilder.annotation.SmallTest;
9 9
10 import org.chromium.base.PathUtils; 10 import org.chromium.base.PathUtils;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 CronetTestFramework testFramework = 47 CronetTestFramework testFramework =
48 startCronetTestFrameworkWithUrlAndCommandLineArgs(URL, commandLi neArgs); 48 startCronetTestFrameworkWithUrlAndCommandLineArgs(URL, commandLi neArgs);
49 49
50 // Make sure that the URL is set as expected. 50 // Make sure that the URL is set as expected.
51 assertEquals(URL, testFramework.getUrl()); 51 assertEquals(URL, testFramework.getUrl());
52 assertEquals(200, testFramework.getHttpStatusCode()); 52 assertEquals(200, testFramework.getHttpStatusCode());
53 } 53 }
54 54
55 @SmallTest 55 @SmallTest
56 @Feature({"Cronet"}) 56 @Feature({"Cronet"})
57 @OnlyRunNativeCronet
pauljensen 2015/12/08 19:49:53 can we add comment saying "no NetLog from HttpURLC
Charles 2015/12/11 16:45:40 Done.
57 public void testNetLog() throws Exception { 58 public void testNetLog() throws Exception {
58 Context context = getContext(); 59 Context context = getContext();
59 File directory = new File(PathUtils.getDataDirectory(context)); 60 File directory = new File(PathUtils.getDataDirectory(context));
60 File file = File.createTempFile("cronet", "json", directory); 61 File file = File.createTempFile("cronet", "json", directory);
61 HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory( 62 HttpUrlRequestFactory factory = HttpUrlRequestFactory.createFactory(
62 context, 63 context,
63 new UrlRequestContextConfig().setLibraryName("cronet_tests")); 64 new UrlRequestContextConfig().setLibraryName("cronet_tests"));
64 // Start NetLog immediately after the request context is created to make 65 // Start NetLog immediately after the request context is created to make
65 // sure that the call won't crash the app even when the native request 66 // sure that the call won't crash the app even when the native request
66 // context is not fully initialized. See crbug.com/470196. 67 // context is not fully initialized. See crbug.com/470196.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 URL, HttpUrlRequest.REQUEST_PRIORITY_MEDIUM, headers, listener); 159 URL, HttpUrlRequest.REQUEST_PRIORITY_MEDIUM, headers, listener);
159 request.setHttpMethod("HEAD"); 160 request.setHttpMethod("HEAD");
160 request.start(); 161 request.start();
161 listener.blockForComplete(); 162 listener.blockForComplete();
162 assertEquals(200, listener.mHttpStatusCode); 163 assertEquals(200, listener.mHttpStatusCode);
163 // HEAD requests do not get any response data and Content-Length must be 164 // HEAD requests do not get any response data and Content-Length must be
164 // ignored. 165 // ignored.
165 assertEquals(0, listener.mResponseAsBytes.length); 166 assertEquals(0, listener.mResponseAsBytes.length);
166 } 167 }
167 } 168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698