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

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/common/CleanupReferenceTest.java

Issue 1880793002: Fix CleanupReferenceTest on Android M (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.content.common; 5 package org.chromium.content.common;
6 6
7 import android.test.InstrumentationTestCase; 7 import android.test.InstrumentationTestCase;
8 import android.test.suitebuilder.annotation.SmallTest; 8 import android.test.suitebuilder.annotation.SmallTest;
9 9
10 import org.chromium.base.annotations.SuppressFBWarnings; 10 import org.chromium.base.annotations.SuppressFBWarnings;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 public void setUp() throws Exception { 44 public void setUp() throws Exception {
45 super.setUp(); 45 super.setUp();
46 sObjectCount.set(0); 46 sObjectCount.set(0);
47 } 47 }
48 48
49 @SuppressFBWarnings("DM_GC") 49 @SuppressFBWarnings("DM_GC")
50 private void collectGarbage() { 50 private void collectGarbage() {
51 // While this is only a 'hint' to the VM, it's generally effective and s ufficient on 51 // While this is only a 'hint' to the VM, it's generally effective and s ufficient on
52 // dalvik. If this changes in future, maybe try allocating a few gargant uan objects 52 // dalvik. If this changes in future, maybe try allocating a few gargant uan objects
53 // too, to force the GC to work. 53 // too, to force the GC to work.
54 System.gc(); 54 Runtime.getRuntime().gc();
55 } 55 }
56 56
57 @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE") 57 @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
58 @SmallTest 58 @SmallTest
59 @Feature({"AndroidWebView"}) 59 @Feature({"AndroidWebView"})
60 public void testCreateSingle() throws Throwable { 60 public void testCreateSingle() throws Throwable {
61 assertEquals(0, sObjectCount.get()); 61 assertEquals(0, sObjectCount.get());
62 62
63 ReferredObject instance = new ReferredObject(); 63 ReferredObject instance = new ReferredObject();
64 assertEquals(1, sObjectCount.get()); 64 assertEquals(1, sObjectCount.get());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 collectGarbage(); 98 collectGarbage();
99 CriteriaHelper.pollInstrumentationThread(Criteria.equals(0, new Callable <Integer>() { 99 CriteriaHelper.pollInstrumentationThread(Criteria.equals(0, new Callable <Integer>() {
100 @Override 100 @Override
101 public Integer call() { 101 public Integer call() {
102 return sObjectCount.get(); 102 return sObjectCount.get();
103 } 103 }
104 })); 104 }));
105 } 105 }
106 106
107 } 107 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698