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