diff options
author | Dave Tharp <dtharp@codeaurora.org> | 2015-04-16 13:45:39 -0700 |
---|---|---|
committer | WebTech Code Review <code-review@localhost> | 2015-04-20 13:18:52 -0700 |
commit | 0f0bd54fd96ffdab1a6fe3f883e4f7514a2323ac (patch) | |
tree | 187dae09179d9141ff52f69750d65dbf378204cb /src/com/android/browser/mdm | |
parent | c07161e487c62d12af82a36892633981b55afc97 (diff) | |
download | android_packages_apps_Gello-0f0bd54fd96ffdab1a6fe3f883e4f7514a2323ac.tar.gz android_packages_apps_Gello-0f0bd54fd96ffdab1a6fe3f883e4f7514a2323ac.tar.bz2 android_packages_apps_Gello-0f0bd54fd96ffdab1a6fe3f883e4f7514a2323ac.zip |
Added test for Proxy Restriction sequencing issue
We now test to ensure setting modes without first clearing
behaves as you would expect.
Change-Id: If3c54e1203ee5072dbabbbbaa0d33be7798810ca
Diffstat (limited to 'src/com/android/browser/mdm')
-rw-r--r-- | src/com/android/browser/mdm/tests/ProxyRestrictionsTest.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/com/android/browser/mdm/tests/ProxyRestrictionsTest.java b/src/com/android/browser/mdm/tests/ProxyRestrictionsTest.java index 3a502e85..fd63ebff 100644 --- a/src/com/android/browser/mdm/tests/ProxyRestrictionsTest.java +++ b/src/com/android/browser/mdm/tests/ProxyRestrictionsTest.java @@ -264,6 +264,62 @@ public class ProxyRestrictionsTest extends ActivityInstrumentationTestCase2<Brow checkValue(ProxyChangeListener.PROXY_PAC_URL, pacUrl); } + public void testProxy_SwitchModesWithoutClear() throws Throwable { + String mode; + Log.v(TAG, "== Testing Proxy Switch =="); + + String proxyHost = "192.241.207.220"; + String proxyPort = "9090"; + String proxyServer = "http://" + proxyHost + ":" + proxyPort; + String configuredMode; + + // Clear any restrictions + setProxyRestrictions(null, null, null, null); + + // + // set to Fixed Servers with exclusion list + // + mode = ProxyChangeListener.MODE_FIXED_SERVERS; + Log.v(TAG, "-- Setting mode " + mode + " =="); + + setProxyRestrictions(mode, proxyServer, "*.google.com, *foo.com, 127.0.0.1:8080", null); + + // check configured proxy mode + configuredMode = ProxyChangeListener.getmMdmProxyMode(); + assertNotNull(configuredMode); + assertEquals(mode + ": configuration",mode,configuredMode); + + //logProxyConfig(ProxyChangeListener.getMdmProxyConfig()); + + // check properties + checkValue("http.proxyHost", proxyHost); + checkValue("http.proxyPort", proxyPort); + + String expected = "*.google.com|*foo.com|127.0.0.1:8080"; + checkValue("http.nonProxyHosts", expected); + + // + // Now set to direct mode + // + mode = ProxyChangeListener.MODE_DIRECT; + Log.v(TAG, "-- Setting mode " + mode + " =="); + + // set the restrictions + setProxyRestrictions(mode, null, null, null); + + // check configured proxy mode + configuredMode = ProxyChangeListener.getmMdmProxyMode(); + assertEquals(mode + ": configuration", mode, configuredMode); + + // get the proxy config from ProxyChangeListener + ProxyChangeListener.ProxyConfig pc = ProxyChangeListener.getMdmProxyConfig(); + assertNull(mode +": proxyConfig should be null", pc); + + checkValue("http.proxyHost", null); + checkValue("http.proxyPort", null); + checkValue("http.nonProxyHosts", null); + } + /** * Activate Proxy restriction |