| Index: chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferencesTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferencesTest.java
|
| index 6d9b5484362b6c50314645839dc48bb13378d7c8..84b32d3001875994f2232f4599166f6fcb41b621 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferencesTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/website/SiteSettingsPreferencesTest.java
|
| @@ -6,22 +6,13 @@
|
|
|
| import android.content.Intent;
|
| import android.os.Bundle;
|
| -import android.support.test.InstrumentationRegistry;
|
| import android.support.test.filters.SmallTest;
|
| -
|
| -import org.junit.After;
|
| -import org.junit.Assert;
|
| -import org.junit.Before;
|
| -import org.junit.Rule;
|
| -import org.junit.Test;
|
| -import org.junit.runner.RunWith;
|
|
|
| import org.chromium.base.ThreadUtils;
|
| import org.chromium.base.test.util.CommandLineFlags;
|
| import org.chromium.base.test.util.Feature;
|
| import org.chromium.base.test.util.RetryOnFailure;
|
| import org.chromium.chrome.browser.ChromeActivity;
|
| -import org.chromium.chrome.browser.ChromeSwitches;
|
| import org.chromium.chrome.browser.infobar.InfoBarContainer;
|
| import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference;
|
| import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
|
| @@ -29,8 +20,7 @@
|
| import org.chromium.chrome.browser.preferences.PrefServiceBridge;
|
| import org.chromium.chrome.browser.preferences.Preferences;
|
| import org.chromium.chrome.browser.preferences.PreferencesLauncher;
|
| -import org.chromium.chrome.test.ChromeActivityTestRule;
|
| -import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
|
| +import org.chromium.chrome.test.ChromeActivityTestCaseBase;
|
| import org.chromium.chrome.test.util.InfoBarTestAnimationListener;
|
| import org.chromium.chrome.test.util.browser.LocationSettingsTestUtil;
|
| import org.chromium.content.common.ContentSwitches;
|
| @@ -41,27 +31,30 @@
|
| /**
|
| * Tests for everything under Settings > Site Settings.
|
| */
|
| -@RunWith(ChromeJUnit4ClassRunner.class)
|
| @RetryOnFailure
|
| -@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
|
| - ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG})
|
| -public class SiteSettingsPreferencesTest {
|
| - @Rule
|
| - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule =
|
| - new ChromeActivityTestRule<>(ChromeActivity.class);
|
| +public class SiteSettingsPreferencesTest extends ChromeActivityTestCaseBase<ChromeActivity> {
|
|
|
| private EmbeddedTestServer mTestServer;
|
|
|
| - @Before
|
| - public void setUp() throws Exception {
|
| - mActivityTestRule.startMainActivityOnBlankPage();
|
| - mTestServer = EmbeddedTestServer.createAndStartServer(
|
| - InstrumentationRegistry.getInstrumentation().getContext());
|
| - }
|
| -
|
| - @After
|
| - public void tearDown() throws Exception {
|
| + public SiteSettingsPreferencesTest() {
|
| + super(ChromeActivity.class);
|
| + }
|
| +
|
| + @Override
|
| + protected void setUp() throws Exception {
|
| + super.setUp();
|
| + mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation().getContext());
|
| + }
|
| +
|
| + @Override
|
| + protected void tearDown() throws Exception {
|
| mTestServer.stopAndDestroyServer();
|
| + super.tearDown();
|
| + }
|
| +
|
| + @Override
|
| + public void startMainActivity() throws InterruptedException {
|
| + startMainActivityOnBlankPage();
|
| }
|
|
|
| private void setAllowLocation(final boolean enabled) {
|
| @@ -79,8 +72,8 @@
|
| SingleCategoryPreferences.READ_WRITE_TOGGLE_KEY);
|
|
|
| websitePreferences.onPreferenceChange(location, enabled);
|
| - Assert.assertEquals("Location should be " + (enabled ? "allowed" : "blocked"),
|
| - enabled, LocationSettings.getInstance().areAllLocationSettingsEnabled());
|
| + assertEquals("Location should be " + (enabled ? "allowed" : "blocked"), enabled,
|
| + LocationSettings.getInstance().areAllLocationSettingsEnabled());
|
| preferenceActivity.finish();
|
| }
|
| });
|
| @@ -91,9 +84,8 @@
|
| new Callable<InfoBarTestAnimationListener>() {
|
| @Override
|
| public InfoBarTestAnimationListener call() throws Exception {
|
| - InfoBarContainer container = mActivityTestRule.getActivity()
|
| - .getActivityTab()
|
| - .getInfoBarContainer();
|
| + InfoBarContainer container =
|
| + getActivity().getActivityTab().getInfoBarContainer();
|
| InfoBarTestAnimationListener listener = new InfoBarTestAnimationListener();
|
| container.addAnimationListener(listener);
|
| return listener;
|
| @@ -104,7 +96,6 @@
|
| /**
|
| * Sets Allow Location Enabled to be true and make sure it is set correctly.
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testSetAllowLocationEnabled() throws Exception {
|
| @@ -112,58 +103,54 @@
|
| InfoBarTestAnimationListener listener = setInfoBarAnimationListener();
|
|
|
| // Launch a page that uses geolocation and make sure an infobar shows up.
|
| - mActivityTestRule.loadUrl(
|
| - mTestServer.getURL("/chrome/test/data/geolocation/geolocation_on_load.html"));
|
| + loadUrl(mTestServer.getURL(
|
| + "/chrome/test/data/geolocation/geolocation_on_load.html"));
|
| listener.addInfoBarAnimationFinished("InfoBar not added.");
|
|
|
| - Assert.assertEquals("Wrong infobar count", 1, mActivityTestRule.getInfoBars().size());
|
| + assertEquals("Wrong infobar count", 1, getInfoBars().size());
|
| }
|
|
|
| /**
|
| * Sets Allow Location Enabled to be false and make sure it is set correctly.
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testSetAllowLocationNotEnabled() throws Exception {
|
| setAllowLocation(false);
|
|
|
| // Launch a page that uses geolocation.
|
| - mActivityTestRule.loadUrl(
|
| - mTestServer.getURL("/chrome/test/data/geolocation/geolocation_on_load.html"));
|
| + loadUrl(mTestServer.getURL(
|
| + "/chrome/test/data/geolocation/geolocation_on_load.html"));
|
|
|
| // No infobars are expected.
|
| - Assert.assertTrue(mActivityTestRule.getInfoBars().isEmpty());
|
| + assertTrue(getInfoBars().isEmpty());
|
| }
|
|
|
| private Preferences startSiteSettingsMenu(String category) {
|
| Bundle fragmentArgs = new Bundle();
|
| fragmentArgs.putString(SingleCategoryPreferences.EXTRA_CATEGORY, category);
|
| Intent intent = PreferencesLauncher.createIntentForSettingsPage(
|
| - InstrumentationRegistry.getInstrumentation().getTargetContext(),
|
| - SiteSettingsPreferences.class.getName());
|
| + getInstrumentation().getTargetContext(), SiteSettingsPreferences.class.getName());
|
| intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
|
| - return (Preferences) InstrumentationRegistry.getInstrumentation().startActivitySync(intent);
|
| + return (Preferences) getInstrumentation().startActivitySync(intent);
|
| }
|
|
|
| private Preferences startSiteSettingsCategory(String category) {
|
| Bundle fragmentArgs = new Bundle();
|
| fragmentArgs.putString(SingleCategoryPreferences.EXTRA_CATEGORY, category);
|
| Intent intent = PreferencesLauncher.createIntentForSettingsPage(
|
| - InstrumentationRegistry.getInstrumentation().getTargetContext(),
|
| - SingleCategoryPreferences.class.getName());
|
| + getInstrumentation().getTargetContext(), SingleCategoryPreferences.class.getName());
|
| intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
|
| - return (Preferences) InstrumentationRegistry.getInstrumentation().startActivitySync(intent);
|
| + return (Preferences) getInstrumentation().startActivitySync(intent);
|
| }
|
|
|
| private Preferences startSingleWebsitePreferences(Website site) {
|
| Bundle fragmentArgs = new Bundle();
|
| fragmentArgs.putSerializable(SingleWebsitePreferences.EXTRA_SITE, site);
|
| Intent intent = PreferencesLauncher.createIntentForSettingsPage(
|
| - InstrumentationRegistry.getInstrumentation().getTargetContext(),
|
| - SingleWebsitePreferences.class.getName());
|
| + getInstrumentation().getTargetContext(), SingleWebsitePreferences.class.getName());
|
| intent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArgs);
|
| - return (Preferences) InstrumentationRegistry.getInstrumentation().startActivitySync(intent);
|
| + return (Preferences) getInstrumentation().startActivitySync(intent);
|
| }
|
|
|
| private void setCookiesEnabled(final Preferences preferenceActivity, final boolean enabled) {
|
| @@ -179,11 +166,11 @@
|
| (ChromeBaseCheckBoxPreference) websitePreferences.findPreference(
|
| SingleCategoryPreferences.THIRD_PARTY_COOKIES_TOGGLE_KEY);
|
|
|
| - Assert.assertEquals("Third-party cookie toggle should be "
|
| - + (doesAcceptCookies() ? "enabled" : " disabled"),
|
| + assertEquals("Third-party cookie toggle should be "
|
| + + (doesAcceptCookies() ? "enabled" : " disabled"),
|
| doesAcceptCookies(), thirdPartyCookies.isEnabled());
|
| websitePreferences.onPreferenceChange(cookies, enabled);
|
| - Assert.assertEquals("Cookies should be " + (enabled ? "allowed" : "blocked"),
|
| + assertEquals("Cookies should be " + (enabled ? "allowed" : "blocked"),
|
| doesAcceptCookies(), enabled);
|
| }
|
|
|
| @@ -205,8 +192,7 @@
|
| SingleCategoryPreferences.THIRD_PARTY_COOKIES_TOGGLE_KEY);
|
|
|
| websitePreferences.onPreferenceChange(thirdPartyCookies, enabled);
|
| - Assert.assertEquals(
|
| - "Third-party cookies should be " + (enabled ? "allowed" : "blocked"),
|
| + assertEquals("Third-party cookies should be " + (enabled ? "allowed" : "blocked"),
|
| !PrefServiceBridge.getInstance().isBlockThirdPartyCookiesEnabled(),
|
| enabled);
|
| }
|
| @@ -226,8 +212,8 @@
|
| websitePreferences.findPreference(
|
| SingleCategoryPreferences.READ_WRITE_TOGGLE_KEY);
|
| websitePreferences.onPreferenceChange(popups, enabled);
|
| - Assert.assertEquals("Popups should be " + (enabled ? "allowed" : "blocked"),
|
| - enabled, PrefServiceBridge.getInstance().popupsEnabled());
|
| + assertEquals("Popups should be " + (enabled ? "allowed" : "blocked"), enabled,
|
| + PrefServiceBridge.getInstance().popupsEnabled());
|
| }
|
| });
|
| preferenceActivity.finish();
|
| @@ -246,7 +232,7 @@
|
| websitePreferences.findPreference(
|
| SingleCategoryPreferences.READ_WRITE_TOGGLE_KEY);
|
| websitePreferences.onPreferenceChange(toggle, enabled);
|
| - Assert.assertEquals("Camera should be " + (enabled ? "allowed" : "blocked"),
|
| + assertEquals("Camera should be " + (enabled ? "allowed" : "blocked"),
|
| enabled, PrefServiceBridge.getInstance().isCameraEnabled());
|
| }
|
| });
|
| @@ -266,8 +252,8 @@
|
| websitePreferences.findPreference(
|
| SingleCategoryPreferences.READ_WRITE_TOGGLE_KEY);
|
| websitePreferences.onPreferenceChange(toggle, enabled);
|
| - Assert.assertEquals("Mic should be " + (enabled ? "allowed" : "blocked"), enabled,
|
| - PrefServiceBridge.getInstance().isMicEnabled());
|
| + assertEquals("Mic should be " + (enabled ? "allowed" : "blocked"),
|
| + enabled, PrefServiceBridge.getInstance().isMicEnabled());
|
| }
|
| });
|
| preferenceActivity.finish();
|
| @@ -296,7 +282,6 @@
|
| * Tests that disabling cookies turns off the third-party cookie toggle.
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testThirdPartyCookieToggleGetsDisabled() throws Exception {
|
| @@ -312,7 +297,6 @@
|
| /**
|
| * Allows cookies to be set and ensures that they are.
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testCookiesNotBlocked() throws Exception {
|
| @@ -324,22 +308,19 @@
|
| final String url = mTestServer.getURL("/chrome/test/data/android/cookie.html");
|
|
|
| // Load the page and clear any set cookies.
|
| - mActivityTestRule.loadUrl(url + "#clear");
|
| - Assert.assertEquals("\"\"", mActivityTestRule.runJavaScriptCodeInCurrentTab("getCookie()"));
|
| - mActivityTestRule.runJavaScriptCodeInCurrentTab("setCookie()");
|
| - Assert.assertEquals(
|
| - "\"Foo=Bar\"", mActivityTestRule.runJavaScriptCodeInCurrentTab("getCookie()"));
|
| + loadUrl(url + "#clear");
|
| + assertEquals("\"\"", runJavaScriptCodeInCurrentTab("getCookie()"));
|
| + runJavaScriptCodeInCurrentTab("setCookie()");
|
| + assertEquals("\"Foo=Bar\"", runJavaScriptCodeInCurrentTab("getCookie()"));
|
|
|
| // Load the page again and ensure the cookie still is set.
|
| - mActivityTestRule.loadUrl(url);
|
| - Assert.assertEquals(
|
| - "\"Foo=Bar\"", mActivityTestRule.runJavaScriptCodeInCurrentTab("getCookie()"));
|
| + loadUrl(url);
|
| + assertEquals("\"Foo=Bar\"", runJavaScriptCodeInCurrentTab("getCookie()"));
|
| }
|
|
|
| /**
|
| * Blocks cookies from being set and ensures that no cookies can be set.
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testCookiesBlocked() throws Exception {
|
| @@ -351,55 +332,52 @@
|
| final String url = mTestServer.getURL("/chrome/test/data/android/cookie.html");
|
|
|
| // Load the page and clear any set cookies.
|
| - mActivityTestRule.loadUrl(url + "#clear");
|
| - Assert.assertEquals("\"\"", mActivityTestRule.runJavaScriptCodeInCurrentTab("getCookie()"));
|
| - mActivityTestRule.runJavaScriptCodeInCurrentTab("setCookie()");
|
| - Assert.assertEquals("\"\"", mActivityTestRule.runJavaScriptCodeInCurrentTab("getCookie()"));
|
| + loadUrl(url + "#clear");
|
| + assertEquals("\"\"", runJavaScriptCodeInCurrentTab("getCookie()"));
|
| + runJavaScriptCodeInCurrentTab("setCookie()");
|
| + assertEquals("\"\"", runJavaScriptCodeInCurrentTab("getCookie()"));
|
|
|
| // Load the page again and ensure the cookie remains unset.
|
| - mActivityTestRule.loadUrl(url);
|
| - Assert.assertEquals("\"\"", mActivityTestRule.runJavaScriptCodeInCurrentTab("getCookie()"));
|
| + loadUrl(url);
|
| + assertEquals("\"\"", runJavaScriptCodeInCurrentTab("getCookie()"));
|
| }
|
|
|
| /**
|
| * Sets Allow Popups Enabled to be false and make sure it is set correctly.
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testPopupsBlocked() throws Exception {
|
| setEnablePopups(false);
|
|
|
| // Test that the popup doesn't open.
|
| - mActivityTestRule.loadUrl(mTestServer.getURL("/chrome/test/data/android/popup.html"));
|
| -
|
| - InstrumentationRegistry.getInstrumentation().waitForIdleSync();
|
| - Assert.assertEquals(1, getTabCount());
|
| + loadUrl(mTestServer.getURL("/chrome/test/data/android/popup.html"));
|
| +
|
| + getInstrumentation().waitForIdleSync();
|
| + assertEquals(1, getTabCount());
|
| }
|
|
|
| /**
|
| * Sets Allow Popups Enabled to be true and make sure it is set correctly.
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testPopupsNotBlocked() throws Exception {
|
| setEnablePopups(true);
|
|
|
| // Test that a popup opens.
|
| - mActivityTestRule.loadUrl(mTestServer.getURL("/chrome/test/data/android/popup.html"));
|
| - InstrumentationRegistry.getInstrumentation().waitForIdleSync();
|
| -
|
| - Assert.assertEquals(2, getTabCount());
|
| + loadUrl(mTestServer.getURL("/chrome/test/data/android/popup.html"));
|
| + getInstrumentation().waitForIdleSync();
|
| +
|
| + assertEquals(2, getTabCount());
|
| }
|
|
|
| /**
|
| * Test that showing the Site Settings menu doesn't crash (crbug.com/610576).
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testSiteSettingsMenu() throws Exception {
|
| @@ -411,7 +389,6 @@
|
| * Test the Media Menu.
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testMediaMenu() throws Exception {
|
| @@ -425,15 +402,15 @@
|
|
|
| SiteSettingsPreference allSites = (SiteSettingsPreference)
|
| siteSettings.findPreference(SiteSettingsPreferences.ALL_SITES_KEY);
|
| - Assert.assertEquals(null, allSites);
|
| + assertEquals(null, allSites);
|
|
|
| SiteSettingsPreference autoplay = (SiteSettingsPreference)
|
| siteSettings.findPreference(SiteSettingsPreferences.AUTOPLAY_KEY);
|
| - Assert.assertFalse(autoplay == null);
|
| + assertFalse(autoplay == null);
|
|
|
| SiteSettingsPreference protectedContent = (SiteSettingsPreference)
|
| siteSettings.findPreference(SiteSettingsPreferences.PROTECTED_CONTENT_KEY);
|
| - Assert.assertFalse(protectedContent == null);
|
| + assertFalse(protectedContent == null);
|
|
|
| preferenceActivity.finish();
|
| }
|
| @@ -444,7 +421,6 @@
|
| * Tests Reset Site not crashing on host names (issue 600232).
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testResetCrash600232() throws Exception {
|
| @@ -467,7 +443,6 @@
|
| * Sets Allow Camera Enabled to be false and make sure it is set correctly.
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| @CommandLineFlags.Add(ContentSwitches.USE_FAKE_DEVICE_FOR_MEDIA_STREAM)
|
| @@ -475,19 +450,17 @@
|
| setEnableCamera(false);
|
|
|
| // Test that the camera permission doesn't get requested.
|
| - mActivityTestRule.loadUrl(mTestServer.getURL("/content/test/data/media/getusermedia.html"));
|
| - mActivityTestRule.runJavaScriptCodeInCurrentTab(
|
| - "getUserMediaAndStop({video: true, audio: false});");
|
| + loadUrl(mTestServer.getURL("/content/test/data/media/getusermedia.html"));
|
| + runJavaScriptCodeInCurrentTab("getUserMediaAndStop({video: true, audio: false});");
|
|
|
| // No infobars are expected.
|
| - Assert.assertTrue(mActivityTestRule.getInfoBars().isEmpty());
|
| + assertTrue(getInfoBars().isEmpty());
|
| }
|
|
|
| /**
|
| * Sets Allow Mic Enabled to be false and make sure it is set correctly.
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| @CommandLineFlags.Add(ContentSwitches.USE_FAKE_DEVICE_FOR_MEDIA_STREAM)
|
| @@ -495,19 +468,17 @@
|
| setEnableMic(false);
|
|
|
| // Test that the microphone permission doesn't get requested.
|
| - mActivityTestRule.loadUrl(mTestServer.getURL("/content/test/data/media/getusermedia.html"));
|
| - mActivityTestRule.runJavaScriptCodeInCurrentTab(
|
| - "getUserMediaAndStop({video: false, audio: true});");
|
| + loadUrl(mTestServer.getURL("/content/test/data/media/getusermedia.html"));
|
| + runJavaScriptCodeInCurrentTab("getUserMediaAndStop({video: false, audio: true});");
|
|
|
| // No infobars are expected.
|
| - Assert.assertTrue(mActivityTestRule.getInfoBars().isEmpty());
|
| + assertTrue(getInfoBars().isEmpty());
|
| }
|
|
|
| /**
|
| * Sets Allow Camera Enabled to be true and make sure it is set correctly.
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| @CommandLineFlags.Add(ContentSwitches.USE_FAKE_DEVICE_FOR_MEDIA_STREAM)
|
| @@ -517,19 +488,17 @@
|
| InfoBarTestAnimationListener listener = setInfoBarAnimationListener();
|
|
|
| // Launch a page that uses camera and make sure an infobar shows up.
|
| - mActivityTestRule.loadUrl(mTestServer.getURL("/content/test/data/media/getusermedia.html"));
|
| - mActivityTestRule.runJavaScriptCodeInCurrentTab(
|
| - "getUserMediaAndStop({video: true, audio: false});");
|
| + loadUrl(mTestServer.getURL("/content/test/data/media/getusermedia.html"));
|
| + runJavaScriptCodeInCurrentTab("getUserMediaAndStop({video: true, audio: false});");
|
|
|
| listener.addInfoBarAnimationFinished("InfoBar not added.");
|
| - Assert.assertEquals("Wrong infobar count", 1, mActivityTestRule.getInfoBars().size());
|
| + assertEquals("Wrong infobar count", 1, getInfoBars().size());
|
| }
|
|
|
| /**
|
| * Sets Allow Mic Enabled to be true and make sure it is set correctly.
|
| * @throws Exception
|
| */
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| @CommandLineFlags.Add(ContentSwitches.USE_FAKE_DEVICE_FOR_MEDIA_STREAM)
|
| @@ -539,12 +508,11 @@
|
| InfoBarTestAnimationListener listener = setInfoBarAnimationListener();
|
|
|
| // Launch a page that uses the microphone and make sure an infobar shows up.
|
| - mActivityTestRule.loadUrl(mTestServer.getURL("/content/test/data/media/getusermedia.html"));
|
| - mActivityTestRule.runJavaScriptCodeInCurrentTab(
|
| - "getUserMediaAndStop({video: false, audio: true});");
|
| + loadUrl(mTestServer.getURL("/content/test/data/media/getusermedia.html"));
|
| + runJavaScriptCodeInCurrentTab("getUserMediaAndStop({video: false, audio: true});");
|
|
|
| listener.addInfoBarAnimationFinished("InfoBar not added.");
|
| - Assert.assertEquals("Wrong infobar count", 1, mActivityTestRule.getInfoBars().size());
|
| + assertEquals("Wrong infobar count", 1, getInfoBars().size());
|
| }
|
|
|
| /**
|
| @@ -556,21 +524,18 @@
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @Override
|
| public void run() {
|
| - Assert.assertEquals(
|
| - "Background Sync should be " + (enabled ? "enabled" : "disabled"),
|
| + assertEquals("Background Sync should be " + (enabled ? "enabled" : "disabled"),
|
| PrefServiceBridge.getInstance().isBackgroundSyncAllowed(), enabled);
|
| }
|
| });
|
| }
|
|
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testAllowBackgroundSync() {
|
| doTestBackgroundSyncPermission(true);
|
| }
|
|
|
| - @Test
|
| @SmallTest
|
| @Feature({"Preferences"})
|
| public void testBlockBackgroundSync() {
|
| @@ -581,7 +546,7 @@
|
| return ThreadUtils.runOnUiThreadBlockingNoException(new Callable<Integer>() {
|
| @Override
|
| public Integer call() throws Exception {
|
| - return mActivityTestRule.getActivity().getTabModelSelector().getTotalTabCount();
|
| + return getActivity().getTabModelSelector().getTotalTabCount();
|
| }
|
| });
|
| }
|
|
|