urbanairship-core/src/test/java/com/urbanairship/js/WhitelistTest.java
@Test
    public void testDefaultWhitelist() {
        AirshipConfigOptions airshipConfigOptions = new AirshipConfigOptions.Builder()
                .setDevelopmentAppKey("appKey")
                .setDevelopmentAppSecret("appSecret")
                .build();

        Whitelist whitelist = Whitelist.createDefaultWhitelist(airshipConfigOptions);
        whitelist.setOpenUrlWhitelistingEnabled(true);

        // Messages
        assertTrue(whitelist.isWhitelisted("https://device-api.urbanairship.com/api/user/", Whitelist.SCOPE_OPEN_URL));
        assertTrue(whitelist.isWhitelisted("https://device-api.urbanairship.com/api/user/", Whitelist.SCOPE_JAVASCRIPT_INTERFACE));
        assertTrue(whitelist.isWhitelisted("https://device-api.urbanairship.com/api/user/", Whitelist.SCOPE_ALL));

        // Starbucks
        assertTrue(whitelist.isWhitelisted("https://sbux-dl.urbanairship.com/binary/token/", Whitelist.SCOPE_OPEN_URL));
        assertTrue(whitelist.isWhitelisted("https://sbux-dl.urbanairship.com/binary/token/", Whitelist.SCOPE_JAVASCRIPT_INTERFACE));
        assertTrue(whitelist.isWhitelisted("https://sbux-dl.urbanairship.com/binary/token/", Whitelist.SCOPE_ALL));

        // Landing Page
        assertTrue(whitelist.isWhitelisted("https://dl.urbanairship.com/aaa/message_id", Whitelist.SCOPE_OPEN_URL));
        assertTrue(whitelist.isWhitelisted("https://dl.urbanairship.com/aaa/message_id", Whitelist.SCOPE_JAVASCRIPT_INTERFACE));
        assertTrue(whitelist.isWhitelisted("https://dl.urbanairship.com/aaa/message_id", Whitelist.SCOPE_ALL));

        // Youtube
        assertTrue(whitelist.isWhitelisted("https://www.youtube.com/embed/wJelEXaPhJ8", Whitelist.SCOPE_OPEN_URL));
        assertFalse(whitelist.isWhitelisted("https://www.youtube.com/embed/wJelEXaPhJ8", Whitelist.SCOPE_JAVASCRIPT_INTERFACE));
        assertFalse(whitelist.isWhitelisted("https://www.youtube.com/embed/wJelEXaPhJ8", Whitelist.SCOPE_ALL));
    }
/**
     * Test the default white list accepts Urban Airship URLs.
     */
Test the default white list accepts Urban Airship URLs.
Test the default white list accepts Urban Airship URLs .
@Test
    public void testDefaultWhitelist() {
        AirshipConfigOptions airshipConfigOptions = new AirshipConfigOptions.Builder()
                .setDevelopmentAppKey("appKey")
                .setDevelopmentAppSecret("appSecret")
                .build();
        Whitelist whitelist = Whitelist.createDefaultWhitelist(airshipConfigOptions);
        whitelist.setOpenUrlWhitelistingEnabled(true);
        assertTrue(whitelist.isWhitelisted("https://device-api.urbanairship.com/api/user/", Whitelist.SCOPE_OPEN_URL));
        assertTrue(whitelist.isWhitelisted("https://device-api.urbanairship.com/api/user/", Whitelist.SCOPE_JAVASCRIPT_INTERFACE));
        assertTrue(whitelist.isWhitelisted("https://device-api.urbanairship.com/api/user/", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("https://sbux-dl.urbanairship.com/binary/token/", Whitelist.SCOPE_OPEN_URL));
        assertTrue(whitelist.isWhitelisted("https://sbux-dl.urbanairship.com/binary/token/", Whitelist.SCOPE_JAVASCRIPT_INTERFACE));
        assertTrue(whitelist.isWhitelisted("https://sbux-dl.urbanairship.com/binary/token/", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("https://dl.urbanairship.com/aaa/message_id", Whitelist.SCOPE_OPEN_URL));
        assertTrue(whitelist.isWhitelisted("https://dl.urbanairship.com/aaa/message_id", Whitelist.SCOPE_JAVASCRIPT_INTERFACE));
        assertTrue(whitelist.isWhitelisted("https://dl.urbanairship.com/aaa/message_id", Whitelist.SCOPE_ALL));
        assertTrue(whitelist.isWhitelisted("https://www.youtube.com/embed/wJelEXaPhJ8", Whitelist.SCOPE_OPEN_URL));
        assertFalse(whitelist.isWhitelisted("https://www.youtube.com/embed/wJelEXaPhJ8", Whitelist.SCOPE_JAVASCRIPT_INTERFACE));
        assertFalse(whitelist.isWhitelisted("https://www.youtube.com/embed/wJelEXaPhJ8", Whitelist.SCOPE_ALL));
    }
@ Test public void testDefaultWhitelist ( ) { AirshipConfigOptions airshipConfigOptions = new AirshipConfigOptions . Builder ( ) . setDevelopmentAppKey ( "appKey" ) . setDevelopmentAppSecret ( "appSecret" ) . build ( ) ; Whitelist whitelist = Whitelist . createDefaultWhitelist ( airshipConfigOptions ) ; whitelist . setOpenUrlWhitelistingEnabled ( true ) ; assertTrue ( whitelist . isWhitelisted ( "https://device-api.urbanairship.com/api/user/" , Whitelist . SCOPE_OPEN_URL ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://device-api.urbanairship.com/api/user/" , Whitelist . SCOPE_JAVASCRIPT_INTERFACE ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://device-api.urbanairship.com/api/user/" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://sbux-dl.urbanairship.com/binary/token/" , Whitelist . SCOPE_OPEN_URL ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://sbux-dl.urbanairship.com/binary/token/" , Whitelist . SCOPE_JAVASCRIPT_INTERFACE ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://sbux-dl.urbanairship.com/binary/token/" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://dl.urbanairship.com/aaa/message_id" , Whitelist . SCOPE_OPEN_URL ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://dl.urbanairship.com/aaa/message_id" , Whitelist . SCOPE_JAVASCRIPT_INTERFACE ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://dl.urbanairship.com/aaa/message_id" , Whitelist . SCOPE_ALL ) ) ; assertTrue ( whitelist . isWhitelisted ( "https://www.youtube.com/embed/wJelEXaPhJ8" , Whitelist . SCOPE_OPEN_URL ) ) ; assertFalse ( whitelist . isWhitelisted ( "https://www.youtube.com/embed/wJelEXaPhJ8" , Whitelist . SCOPE_JAVASCRIPT_INTERFACE ) ) ; assertFalse ( whitelist . isWhitelisted ( "https://www.youtube.com/embed/wJelEXaPhJ8" , Whitelist . SCOPE_ALL ) ) ; }
Test the default white list accepts Urban Airship URLs.
Test the default white list accepts Urban Airship URLs .
// Messages // Starbucks // Landing Page // Youtube