1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.webkit.cts;
18 
19 /**
20  * This class defines constants for webkit test assets.
21  */
22 public class TestHtmlConstants {
23     public static final String BR_TAG_URL = "webkit/test_br_tag.html";
24     public static final String BR_TAG_TITLE = "test br tag";
25 
26     public static final String HELLO_WORLD_URL = "webkit/test_hello_world.html";
27     public static final String HELLO_WORLD_TITLE = "test hello world";
28 
29     public static final String TEST_FAVICON_URL = "webkit/test_favicon.html";
30 
31     public static final String LARGE_IMG_URL = "images/robot.png";
32     public static final String SMALL_IMG_URL = "images/tomato.png";
33 
34     public static final String EMBEDDED_IMG_URL = "webkit/embedded_image.html";
35     public static final String POPUP_URL = "webkit/popup_base.html";
36     public static final String JAVASCRIPT_URL = "webkit/javascript.html";
37     public static final String JS_ALERT_URL = "webkit/jsalert.html";
38     public static final String JS_CONFIRM_URL = "webkit/jsconfirm.html";
39     public static final String JS_PROMPT_URL = "webkit/jsprompt.html";
40     public static final String JS_UNLOAD_URL = "webkit/jsunload.html";
41     public static final String JS_WINDOW_URL = "webkit/jswindow.html";
42     public static final String JS_TIMEOUT_URL = "webkit/jstimeout.html";
43     public static final String JS_FORM_URL = "webkit/jsform.html";
44 
45     public static final String FONT_URL = "webkit/fonts.html";
46 
47     public static final String NETWORK_STATE_URL = "webkit/network_state.html";
48     public static final String TEST_TIMER_URL = "webkit/test_timer.html";
49 
50     public static final String HTML_URL1 = "webkit/test_firstPage.html";
51     public static final String HTML_URL2 = "webkit/test_secondPage.html";
52     public static final String HTML_URL3 = "webkit/test_thirdPage.html";
53     public static final String HTML_URL1_TITLE = "First page";
54 
55     public static final String BLANK_PAGE_URL = "webkit/test_blankPage.html";
56     public static final String ADD_JAVA_SCRIPT_INTERFACE_URL = "webkit/test_jsInterface.html";
57 
58     public static final String LOGIN_FORM_URL = "webkit/test_loginForm.html";
59 
60     public static final String EXT_WEB_URL1 = "http://www.example.com/";
61 
62     public static final String LOCAL_FILESYSTEM_URL = "file:///etc/hosts";
63 
64     public static final String PARAM_ASSET_URL = "webkit/test_queryparam.html";
65     public static final String ANCHOR_ASSET_URL = "webkit/test_anchor.html";
66     public static final String IMAGE_ACCESS_URL = "webkit/test_imageaccess.html";
67     public static final String IFRAME_ACCESS_URL = "webkit/test_iframeaccess.html";
68     public static final String DATABASE_ACCESS_URL = "webkit/test_databaseaccess.html";
69     public static final String STOP_LOADING_URL = "webkit/test_stop_loading.html";
70     public static final String BLANK_TAG_URL = "webkit/blank_tag.html";
71     public static final String PAGE_WITH_LINK_URL = "webkit/page_with_link.html";
72     public static final String URL_IN_PAGE_WITH_LINK = "http://foo.com/";
73     // Not a real page, just triggers a 404 response.
74     public static final String NON_EXISTENT_PAGE_URL = "webkit/generate_404.html";
75     public static final String BAD_IMAGE_PAGE_URL = "webkit/test_bad_image_url.html";
76 
77     // Must match the title of the page at
78     // android/frameworks/base/core/res/res/raw/loaderror.html
79     public static final String WEBPAGE_NOT_AVAILABLE_TITLE = "Webpage not available";
80 
getFileUrl(String assetName)81     public static final String getFileUrl(String assetName) {
82         if (assetName.contains(":") || assetName.startsWith("/")) {
83             throw new IllegalArgumentException();
84         }
85         return "file:///android_asset/" + assetName;
86     }
87 }
88