FileDocCategorySizeDatePackage
UrlInterceptRegistryTest.javaAPI DocAndroid 1.5 API2920Wed May 06 22:42:02 BST 2009android.webkit

UrlInterceptRegistryTest

public class UrlInterceptRegistryTest extends android.test.AndroidTestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtestGetPluginData()

        PluginData data = new PluginData(null, 0 , null, 200);
        String url = new String("url1");
        MockUrlInterceptHandler handler1 =
                new MockUrlInterceptHandler(data, url);

        data = new PluginData(null, 0 , null, 404);
        url = new String("url2");
        MockUrlInterceptHandler handler2 =
                new MockUrlInterceptHandler(data, url);

        assertTrue(UrlInterceptRegistry.registerHandler(handler1));
        assertTrue(UrlInterceptRegistry.registerHandler(handler2));

        data = UrlInterceptRegistry.getPluginData("url1", null);
        assertTrue(data != null);
        assertTrue(data.getStatusCode() == 200);

        data = UrlInterceptRegistry.getPluginData("url2", null);
        assertTrue(data != null);
        assertTrue(data.getStatusCode() == 404);

        assertTrue(UrlInterceptRegistry.unregisterHandler(handler1));
        assertTrue(UrlInterceptRegistry.unregisterHandler(handler2));