| 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; |
| 11 import android.os.Looper; | 11 import android.os.Looper; |
| 12 import android.os.Process; | 12 import android.os.Process; |
| 13 import android.support.test.filters.SmallTest; | 13 import android.support.test.filters.SmallTest; |
| 14 | 14 |
| 15 import org.json.JSONObject; | 15 import org.json.JSONObject; |
| 16 | 16 |
| 17 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_IN_MEMORY; | 17 import static org.chromium.net.CronetEngine.Builder.HTTP_CACHE_IN_MEMORY; |
| 18 | 18 |
| 19 import org.chromium.base.FileUtils; | 19 import org.chromium.base.FileUtils; |
| 20 import org.chromium.base.PathUtils; | 20 import org.chromium.base.PathUtils; |
| 21 import org.chromium.base.annotations.JNINamespace; | 21 import org.chromium.base.annotations.JNINamespace; |
| 22 import org.chromium.base.test.util.DisabledTest; | |
| 23 import org.chromium.base.test.util.Feature; | 22 import org.chromium.base.test.util.Feature; |
| 24 import org.chromium.net.TestUrlRequestCallback.ResponseStep; | 23 import org.chromium.net.TestUrlRequestCallback.ResponseStep; |
| 25 import org.chromium.net.impl.CronetEngineBuilderImpl; | 24 import org.chromium.net.impl.CronetEngineBuilderImpl; |
| 26 import org.chromium.net.impl.CronetLibraryLoader; | 25 import org.chromium.net.impl.CronetLibraryLoader; |
| 27 import org.chromium.net.impl.CronetUrlRequestContext; | 26 import org.chromium.net.impl.CronetUrlRequestContext; |
| 28 import org.chromium.net.test.EmbeddedTestServer; | 27 import org.chromium.net.test.EmbeddedTestServer; |
| 29 | 28 |
| 30 import java.io.BufferedReader; | 29 import java.io.BufferedReader; |
| 31 import java.io.File; | 30 import java.io.File; |
| 32 import java.io.FileReader; | 31 import java.io.FileReader; |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // Make sure both files contain the two requests made separately using | 479 // Make sure both files contain the two requests made separately using |
| 481 // different engines. | 480 // different engines. |
| 482 assertTrue(containsStringInNetLog(file1, mUrl404)); | 481 assertTrue(containsStringInNetLog(file1, mUrl404)); |
| 483 assertTrue(containsStringInNetLog(file1, mUrl500)); | 482 assertTrue(containsStringInNetLog(file1, mUrl500)); |
| 484 assertTrue(containsStringInNetLog(file2, mUrl404)); | 483 assertTrue(containsStringInNetLog(file2, mUrl404)); |
| 485 assertTrue(containsStringInNetLog(file2, mUrl500)); | 484 assertTrue(containsStringInNetLog(file2, mUrl500)); |
| 486 assertTrue(file1.delete()); | 485 assertTrue(file1.delete()); |
| 487 assertTrue(file2.delete()); | 486 assertTrue(file2.delete()); |
| 488 } | 487 } |
| 489 | 488 |
| 490 //@SmallTest | 489 @SmallTest |
| 491 //@Feature({"Cronet"}) | 490 @Feature({"Cronet"}) |
| 492 //@OnlyRunNativeCronet | 491 @OnlyRunNativeCronet |
| 493 // Frequently crashes on Cronet builders - see crbug.com/729257 | |
| 494 @DisabledTest | |
| 495 // Tests that NetLog contains events emitted by all live CronetEngines. | 492 // Tests that NetLog contains events emitted by all live CronetEngines. |
| 496 public void testBoundedFileNetLogContainEventsFromAllLiveEngines() throws Ex
ception { | 493 public void testBoundedFileNetLogContainEventsFromAllLiveEngines() throws Ex
ception { |
| 497 Context context = getContext(); | 494 Context context = getContext(); |
| 498 File directory = new File(PathUtils.getDataDirectory()); | 495 File directory = new File(PathUtils.getDataDirectory()); |
| 499 File netLogDir1 = new File(directory, "NetLog1"); | 496 File netLogDir1 = new File(directory, "NetLog1"); |
| 500 assertFalse(netLogDir1.exists()); | 497 assertFalse(netLogDir1.exists()); |
| 501 assertTrue(netLogDir1.mkdir()); | 498 assertTrue(netLogDir1.mkdir()); |
| 502 File netLogDir2 = new File(directory, "NetLog2"); | 499 File netLogDir2 = new File(directory, "NetLog2"); |
| 503 assertFalse(netLogDir2.exists()); | 500 assertFalse(netLogDir2.exists()); |
| 504 assertTrue(netLogDir2.mkdir()); | 501 assertTrue(netLogDir2.mkdir()); |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 } | 1323 } |
| 1327 // Test that valid thread priority range (-20..19) is working. | 1324 // Test that valid thread priority range (-20..19) is working. |
| 1328 for (int threadPriority = -20; threadPriority < 20; threadPriority++) { | 1325 for (int threadPriority = -20; threadPriority < 20; threadPriority++) { |
| 1329 builder.setThreadPriority(threadPriority); | 1326 builder.setThreadPriority(threadPriority); |
| 1330 CronetEngine engine = builder.build(); | 1327 CronetEngine engine = builder.build(); |
| 1331 assertEquals(threadPriority, getThreadPriority(engine)); | 1328 assertEquals(threadPriority, getThreadPriority(engine)); |
| 1332 engine.shutdown(); | 1329 engine.shutdown(); |
| 1333 } | 1330 } |
| 1334 } | 1331 } |
| 1335 } | 1332 } |
| OLD | NEW |