Debian Codegraph @

tests/CoreTests/android/core/TestWebData.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2007 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.core;
18
19 /**
20 * Represents test data used by the Request API tests
21 */
22 public class TestWebData {
23
24 /*
25 * Simple Html body
26 * <html>
27 * <body>
28 * <h1>Hello World!</h1>
29 * </body>
30 * </html>
31 */
32 public final static byte[] test1 = {
33 (byte)0x3c, (byte)0x68, (byte)0x74, (byte)0x6d,
34 (byte)0x6c, (byte)0x3e, (byte)0x0a, (byte)0x3c,
35 (byte)0x62, (byte)0x6f, (byte)0x64, (byte)0x79,
36 (byte)0x3e, (byte)0x0a, (byte)0x3c, (byte)0x68,
37 (byte)0x31, (byte)0x3e, (byte)0x48, (byte)0x65,
38 (byte)0x6c, (byte)0x6c, (byte)0x6f, (byte)0x20,
39 (byte)0x57, (byte)0x6f, (byte)0x72, (byte)0x6c,
40 (byte)0x64, (byte)0x21, (byte)0x3c, (byte)0x2f,
41 (byte)0x68, (byte)0x31, (byte)0x3e, (byte)0x0a,
42 (byte)0x3c, (byte)0x2f, (byte)0x62, (byte)0x6f,
43 (byte)0x64, (byte)0x79, (byte)0x3e, (byte)0x0a,
44 (byte)0x3c, (byte)0x2f, (byte)0x68, (byte)0x74,
45 (byte)0x6d, (byte)0x6c, (byte)0x3e, (byte)0x0a
46 };
47
48 /*
49 * Simple Html body
50 * <html>
51 * <body>
52 * <h1>Hello World!</h1>
53 * </body>
54 * </html>
55 */
56 public final static byte[] test2 = {
57 (byte)0x3c, (byte)0x68, (byte)0x74, (byte)0x6d,
58 (byte)0x6c, (byte)0x3e, (byte)0x0a, (byte)0x3c,
59 (byte)0x62, (byte)0x6f, (byte)0x64, (byte)0x79,
60 (byte)0x3e, (byte)0x0a, (byte)0x3c, (byte)0x68,
61 (byte)0x31, (byte)0x3e, (byte)0x48, (byte)0x65,
62 (byte)0x6c, (byte)0x6c, (byte)0x6f, (byte)0x20,
63 (byte)0x57, (byte)0x6f, (byte)0x72, (byte)0x6c,
64 (byte)0x64, (byte)0x21, (byte)0x3c, (byte)0x2f,
65 (byte)0x68, (byte)0x31, (byte)0x3e, (byte)0x0a,
66 (byte)0x3c, (byte)0x2f, (byte)0x62, (byte)0x6f,
67 (byte)0x64, (byte)0x79, (byte)0x3e, (byte)0x0a,
68 (byte)0x3c, (byte)0x2f, (byte)0x68, (byte)0x74,
69 (byte)0x6d, (byte)0x6c, (byte)0x3e, (byte)0x0a
70 };
71
72 // string for test request post body
73 public final static String postContent = "user=111";
74
75 // Array of all test data
76 public final static byte[][] tests = {
77 test1,
78 test2
79 };
80
81 /**
82 * List of static test cases for use with test server
83 */
84 public static TestWebData[] testParams = {
85 new TestWebData(52, 14000000, "test1", "text/html", false),
86 new TestWebData(52, 14000002, "test2", "unknown/unknown", false)
87 };
88
89 /**
90 * List of response strings for use by the test server
91 */
92 public static String[] testServerResponse = {
93 "Redirecting 301",
94 "Redirecting 302",
95 "Redirecting 303",
96 "Redirecting 307"
97 };
98
99 // Redirection indices into testServerResponse
100 public final static int REDIRECT_301 = 0;
101 public final static int REDIRECT_302 = 1;
102 public final static int REDIRECT_303 = 2;
103 public final static int REDIRECT_307 = 3;
104
105 /**
106 * Creates a data package with information used by the server when responding
107 * to requests
108 */
109 TestWebData(int length, int lastModified, String name, String type, boolean isDir) {
110 testLength = length;
111 testLastModified = lastModified;
112 testName = name;
113 testType = type;
114 testDir = isDir;
115 }
116
117 // Length of test entity body
118 public int testLength;
119
120 // Last modified date value (milliseconds)
121 public int testLastModified;
122
123 // Test identification name
124 public String testName;
125
126 // The MIME type to assume for this test
127 public String testType;
128
129 // Indicates if this is a directory or not
130 public boolean testDir;
131
132 }