Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.support.test.filters.LargeTest; | 8 import android.support.test.filters.LargeTest; |
| 9 import android.test.MoreAsserts; | 9 import android.test.MoreAsserts; |
| 10 import android.util.SparseArray; | 10 import android.util.SparseArray; |
| 11 import android.util.SparseBooleanArray; | 11 import android.util.SparseBooleanArray; |
| 12 | 12 |
| 13 import org.chromium.base.ThreadUtils; | 13 import org.chromium.base.ThreadUtils; |
| 14 import org.chromium.base.test.util.CommandLineFlags; | |
| 15 import org.chromium.base.test.util.DisabledTest; | 14 import org.chromium.base.test.util.DisabledTest; |
| 16 import org.chromium.base.test.util.Feature; | 15 import org.chromium.base.test.util.Feature; |
| 17 import org.chromium.base.test.util.Restriction; | 16 import org.chromium.base.test.util.Restriction; |
| 18 import org.chromium.base.test.util.RetryOnFailure; | 17 import org.chromium.base.test.util.RetryOnFailure; |
| 19 import org.chromium.chrome.browser.compositor.layouts.Layout; | 18 import org.chromium.chrome.browser.compositor.layouts.Layout; |
| 20 import org.chromium.chrome.browser.tab.Tab; | 19 import org.chromium.chrome.browser.tab.Tab; |
| 21 import org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator; | 20 import org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator; |
| 22 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; | 21 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; |
| 23 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; | 22 import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType; |
| 24 import org.chromium.chrome.browser.tabmodel.TabModelUtils; | 23 import org.chromium.chrome.browser.tabmodel.TabModelUtils; |
| 25 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 24 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 26 import org.chromium.chrome.test.util.ChromeRestriction; | 25 import org.chromium.chrome.test.util.ChromeRestriction; |
| 27 import org.chromium.chrome.test.util.ChromeTabUtils; | 26 import org.chromium.chrome.test.util.ChromeTabUtils; |
| 28 import org.chromium.chrome.test.util.PrerenderTestHelper; | 27 import org.chromium.chrome.test.util.PrerenderTestHelper; |
| 29 import org.chromium.content.browser.BindingManager; | 28 import org.chromium.content.browser.BindingManager; |
| 30 import org.chromium.content.browser.ChildProcessConnection; | 29 import org.chromium.content.browser.ChildProcessConnection; |
| 31 import org.chromium.content.browser.ChildProcessLauncher; | 30 import org.chromium.content.browser.ChildProcessLauncher; |
| 31 import org.chromium.content.browser.test.ChildProcessAllocatorSettings; | |
| 32 import org.chromium.content.browser.test.util.Criteria; | 32 import org.chromium.content.browser.test.util.Criteria; |
| 33 import org.chromium.content.browser.test.util.CriteriaHelper; | 33 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 34 import org.chromium.content_public.browser.LoadUrlParams; | 34 import org.chromium.content_public.browser.LoadUrlParams; |
| 35 import org.chromium.net.test.EmbeddedTestServer; | 35 import org.chromium.net.test.EmbeddedTestServer; |
| 36 import org.chromium.ui.base.DeviceFormFactor; | 36 import org.chromium.ui.base.DeviceFormFactor; |
| 37 import org.chromium.ui.base.PageTransition; | 37 import org.chromium.ui.base.PageTransition; |
| 38 | 38 |
| 39 import java.util.concurrent.Callable; | 39 import java.util.concurrent.Callable; |
| 40 | 40 |
| 41 /** | 41 /** |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 500 MoreAsserts.assertNotEqual(pid1, pid2); | 500 MoreAsserts.assertNotEqual(pid1, pid2); |
| 501 | 501 |
| 502 assertTrue(mBindingManager.getVisibilityCalls(pid1).contains("DETERMINED ;")); | 502 assertTrue(mBindingManager.getVisibilityCalls(pid1).contains("DETERMINED ;")); |
| 503 assertTrue(mBindingManager.getVisibilityCalls(pid2).contains("DETERMINED ;")); | 503 assertTrue(mBindingManager.getVisibilityCalls(pid2).contains("DETERMINED ;")); |
| 504 } | 504 } |
| 505 | 505 |
| 506 /** | 506 /** |
| 507 * Verifies that BindingManager.releaseAllModerateBindings() is called once all the sandboxed | 507 * Verifies that BindingManager.releaseAllModerateBindings() is called once all the sandboxed |
| 508 * services are allocated. | 508 * services are allocated. |
| 509 */ | 509 */ |
| 510 @CommandLineFlags.Add(ChildProcessLauncher.SWITCH_NUM_SANDBOXED_SERVICES_FOR _TESTING + "=4") | 510 @ChildProcessAllocatorSettings(sandboxedServiceCount = 4) |
|
boliu
2017/04/10 18:43:41
does this work yet for junit3 tests?
Jay Civelli
2017/04/10 19:43:15
I don't see why the version of junit should impact
| |
| 511 @LargeTest | 511 @LargeTest |
| 512 @Feature({"ProcessManagement"}) | 512 @Feature({"ProcessManagement"}) |
| 513 public void testReleaseAllModerateBindings() throws InterruptedException { | 513 public void testReleaseAllModerateBindings() throws InterruptedException { |
| 514 final TabCreator tabCreator = getActivity().getCurrentTabCreator(); | 514 final TabCreator tabCreator = getActivity().getCurrentTabCreator(); |
| 515 final Tab[] tabs = new Tab[3]; | 515 final Tab[] tabs = new Tab[3]; |
| 516 getInstrumentation().runOnMainSync(new Runnable() { | 516 getInstrumentation().runOnMainSync(new Runnable() { |
| 517 @Override | 517 @Override |
| 518 public void run() { | 518 public void run() { |
| 519 // Foreground tab. | 519 // Foreground tab. |
| 520 tabs[0] = tabCreator.createNewTab( | 520 tabs[0] = tabCreator.createNewTab( |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 647 super.tearDown(); | 647 super.tearDown(); |
| 648 } | 648 } |
| 649 | 649 |
| 650 /** | 650 /** |
| 651 * @return the index of the given tab in the current tab model | 651 * @return the index of the given tab in the current tab model |
| 652 */ | 652 */ |
| 653 private int indexOf(Tab tab) { | 653 private int indexOf(Tab tab) { |
| 654 return getActivity().getCurrentTabModel().indexOf(tab); | 654 return getActivity().getCurrentTabModel().indexOf(tab); |
| 655 } | 655 } |
| 656 } | 656 } |
| OLD | NEW |