1 package android.webkit; 2 3 import com.xtremelabs.robolectric.internal.DoNotInstrument; 4 import com.xtremelabs.robolectric.internal.Implementation; 5 6 /** 7 * Concrete implementation of the abstract WebSettings class. 8 */ 9 @DoNotInstrument 10 public class TestWebSettings extends WebSettings { 11 12 private boolean allowFileAccess = true; 13 private boolean allowFileAccessFromFile = true; 14 private boolean allowUniversalAccessFromFile = true; 15 private boolean blockNetworkImage = false; 16 private boolean blockNetworkLoads = false; 17 private boolean builtInZoomControls = true; 18 private boolean databaseEnabled = false; 19 private boolean domStorageEnabled = false; 20 private boolean javaScriptEnabled = false; 21 private boolean lightTouchEnabled = false; 22 private boolean loadWithOverviewMode = false; 23 private boolean needInitialFocus = false; 24 private boolean pluginsEnabled = false; 25 private WebSettings.PluginState pluginState = WebSettings.PluginState.OFF; 26 private boolean supportMultipleWindows = false; 27 private boolean supportZoom = true; 28 TestWebSettings()29 public TestWebSettings() { 30 } 31 32 @Override getAllowFileAccessFromFileURLs()33 public boolean getAllowFileAccessFromFileURLs() { 34 return allowFileAccessFromFile; 35 } 36 37 @Override getAllowUniversalAccessFromFileURLs()38 public boolean getAllowUniversalAccessFromFileURLs() { 39 return allowUniversalAccessFromFile; 40 } 41 42 @Override setAllowFileAccessFromFileURLs(boolean allow)43 public void setAllowFileAccessFromFileURLs(boolean allow) { 44 allowFileAccessFromFile = allow; 45 } 46 47 @Override setAllowUniversalAccessFromFileURLs(boolean allow)48 public void setAllowUniversalAccessFromFileURLs(boolean allow) { 49 allowUniversalAccessFromFile = allow; 50 } 51 52 @Implementation getAllowFileAccess()53 public boolean getAllowFileAccess() { 54 return allowFileAccess; 55 } 56 57 @Implementation setAllowFileAccess(boolean allow)58 public void setAllowFileAccess(boolean allow) { 59 allowFileAccess = allow; 60 } 61 62 @Implementation getBlockNetworkImage()63 public synchronized boolean getBlockNetworkImage() { 64 return blockNetworkImage; 65 } 66 67 @Implementation setBlockNetworkImage(boolean flag)68 public synchronized void setBlockNetworkImage(boolean flag) { 69 blockNetworkImage = flag; 70 } 71 72 @Implementation getBlockNetworkLoads()73 public synchronized boolean getBlockNetworkLoads() { 74 return blockNetworkLoads; 75 } 76 77 @Implementation setBlockNetworkLoads(boolean flag)78 public synchronized void setBlockNetworkLoads(boolean flag) { 79 blockNetworkLoads = flag; 80 } 81 82 @Implementation getBuiltInZoomControls()83 public boolean getBuiltInZoomControls() { 84 return builtInZoomControls; 85 } 86 87 @Implementation setBuiltInZoomControls(boolean enabled)88 public void setBuiltInZoomControls(boolean enabled) { 89 builtInZoomControls = enabled; 90 } 91 92 @Implementation getDatabaseEnabled()93 public synchronized boolean getDatabaseEnabled() { 94 return databaseEnabled; 95 } 96 97 @Implementation setDatabaseEnabled(boolean flag)98 public synchronized void setDatabaseEnabled(boolean flag) { 99 databaseEnabled = flag; 100 } 101 102 @Implementation getDomStorageEnabled()103 public synchronized boolean getDomStorageEnabled() { 104 return domStorageEnabled; 105 } 106 107 @Implementation setDomStorageEnabled(boolean flag)108 public synchronized void setDomStorageEnabled(boolean flag) { 109 domStorageEnabled = flag; 110 } 111 112 @Implementation getJavaScriptEnabled()113 public synchronized boolean getJavaScriptEnabled() { 114 return javaScriptEnabled; 115 } 116 117 @Implementation setJavaScriptEnabled(boolean flag)118 public synchronized void setJavaScriptEnabled(boolean flag) { 119 javaScriptEnabled = flag; 120 } 121 122 @Implementation getLightTouchEnabled()123 public boolean getLightTouchEnabled() { 124 return lightTouchEnabled; 125 } 126 127 @Implementation setLightTouchEnabled(boolean flag)128 public void setLightTouchEnabled(boolean flag) { 129 lightTouchEnabled = flag; 130 } 131 132 @Implementation getLoadWithOverviewMode()133 public boolean getLoadWithOverviewMode() { 134 return loadWithOverviewMode; 135 } 136 137 @Implementation setLoadWithOverviewMode(boolean flag)138 public void setLoadWithOverviewMode(boolean flag) { 139 loadWithOverviewMode = flag; 140 } 141 getNeedInitialFocus()142 public boolean getNeedInitialFocus() { 143 return needInitialFocus; 144 } 145 146 @Implementation setNeedInitialFocus(boolean flag)147 public void setNeedInitialFocus(boolean flag) { 148 needInitialFocus = flag; 149 } 150 151 @Implementation getPluginsEnabled()152 public synchronized boolean getPluginsEnabled() { 153 return pluginsEnabled; 154 } 155 156 @Implementation setPluginsEnabled(boolean flag)157 public synchronized void setPluginsEnabled(boolean flag) { 158 pluginsEnabled = flag; 159 } 160 161 @Implementation getPluginState()162 public synchronized WebSettings.PluginState getPluginState() { 163 return pluginState; 164 } 165 166 @Implementation setPluginState(WebSettings.PluginState state)167 public synchronized void setPluginState(WebSettings.PluginState state) { 168 pluginState = state; 169 } 170 getSupportMultipleWindows()171 public boolean getSupportMultipleWindows() { 172 return supportMultipleWindows; 173 } 174 175 @Implementation setSupportMultipleWindows(boolean support)176 public synchronized void setSupportMultipleWindows(boolean support) { 177 supportMultipleWindows = support; 178 } 179 getSupportZoom()180 public boolean getSupportZoom() { 181 return supportZoom; 182 } 183 184 @Implementation setSupportZoom(boolean support)185 public void setSupportZoom(boolean support) { 186 supportZoom = support; 187 } 188 } 189