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

Side by Side Diff: content/public/android/junit/src/org/chromium/content/browser/BindingManagerImplTest.java

Issue 2760093002: Making callbacks in Android ChildProcessLauncher generic. (Closed)
Patch Set: Created 3 years, 9 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.content.browser; 5 package org.chromium.content.browser;
6 6
7 import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL; 7 import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL;
8 import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; 8 import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW;
9 import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE; 9 import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE;
10 10
11 import android.app.Activity; 11 import android.app.Activity;
12 import android.app.Application; 12 import android.app.Application;
13 import android.os.Bundle; 13 import android.os.Bundle;
14 import android.os.IBinder;
14 import android.util.Pair; 15 import android.util.Pair;
15 16
16 import org.junit.Assert; 17 import org.junit.Assert;
17 import org.junit.Before; 18 import org.junit.Before;
18 import org.junit.Test; 19 import org.junit.Test;
19 import org.junit.runner.RunWith; 20 import org.junit.runner.RunWith;
20 21
21 import org.robolectric.Robolectric; 22 import org.robolectric.Robolectric;
22 import org.robolectric.annotation.Config; 23 import org.robolectric.annotation.Config;
23 import org.robolectric.shadows.ShadowLooper; 24 import org.robolectric.shadows.ShadowLooper;
24 25
25 import org.chromium.base.process_launcher.ChildProcessCreationParams; 26 import org.chromium.base.process_launcher.ChildProcessCreationParams;
26 import org.chromium.base.test.util.Feature; 27 import org.chromium.base.test.util.Feature;
27 import org.chromium.content.common.FileDescriptorInfo; 28 import org.chromium.content.common.FileDescriptorInfo;
28 import org.chromium.content.common.IChildProcessCallback;
29 import org.chromium.content.common.IChildProcessService; 29 import org.chromium.content.common.IChildProcessService;
30 import org.chromium.testing.local.LocalRobolectricTestRunner; 30 import org.chromium.testing.local.LocalRobolectricTestRunner;
31 31
32 import java.util.ArrayList; 32 import java.util.ArrayList;
33 33
34 /** 34 /**
35 * Unit tests for BindingManagerImpl. The tests run agains mock ChildProcessConn ection 35 * Unit tests for BindingManagerImpl. The tests run agains mock ChildProcessConn ection
36 * implementation, thus testing only the BindingManagerImpl itself. 36 * implementation, thus testing only the BindingManagerImpl itself.
37 * 37 *
38 * Default property of being low-end device is overriden, so that both low-end a nd high-end policies 38 * Default property of being low-end device is overriden, so that both low-end a nd high-end policies
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 throw new UnsupportedOperationException(); 120 throw new UnsupportedOperationException();
121 } 121 }
122 122
123 @Override 123 @Override
124 public void start(StartCallback startCallback) { 124 public void start(StartCallback startCallback) {
125 throw new UnsupportedOperationException(); 125 throw new UnsupportedOperationException();
126 } 126 }
127 127
128 @Override 128 @Override
129 public void setupConnection(String[] commandLine, FileDescriptorInfo[] f ilesToBeMapped, 129 public void setupConnection(String[] commandLine, FileDescriptorInfo[] f ilesToBeMapped,
130 IChildProcessCallback processCallback, ConnectionCallback connec tionCallbacks, 130 IBinder callback, ConnectionCallback connectionCallbacks, Bundle sharedRelros) {
131 Bundle sharedRelros) {
132 throw new UnsupportedOperationException(); 131 throw new UnsupportedOperationException();
133 } 132 }
134 133
135 @Override 134 @Override
136 public void addModerateBinding() { 135 public void addModerateBinding() {
137 mModerateBindingBound = true; 136 mModerateBindingBound = true;
138 } 137 }
139 138
140 @Override 139 @Override
141 public void removeModerateBinding() { 140 public void removeModerateBinding() {
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 697
699 manager.onSentToBackground(); 698 manager.onSentToBackground();
700 ShadowLooper.runUiThreadTasksIncludingDelayedTasks(); 699 ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
701 Assert.assertFalse(connection.isModerateBindingBound()); 700 Assert.assertFalse(connection.isModerateBindingBound());
702 701
703 // Bringing Chrome to the foreground should not re-add the moderate bind ings. 702 // Bringing Chrome to the foreground should not re-add the moderate bind ings.
704 manager.onBroughtToForeground(); 703 manager.onBroughtToForeground();
705 Assert.assertFalse(connection.isModerateBindingBound()); 704 Assert.assertFalse(connection.isModerateBindingBound());
706 } 705 }
707 } 706 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698