Unregister from GCM when the only GCM app is removed
[chromium-blink-merge.git] / chrome / test / data / dromaeo / tests / dromaeo-object-string.html
blob836b6e445a70f2d229f48bad234b30d92efa9f4f
1 <html>
2 <head>
3 <script src="../htmlrunner.js"></script>
4 <script>
5 window.onload = function(){ startTest("dromaeo-object-string", 'ef8605c3');
7 // Try to force real results
8 var ret;
9 var num = 80000;
11 // TESTS: String concatenation
13 test( "Concat String", function(){
14 var str = "";
15 for ( var i = 0; i < num; i++ )
16 str += "a";
17 ret = str;
18 });
20 test( "Concat String Object", function(){
21 var str = new String();
22 for ( var i = 0; i < num; i++ )
23 str += "a";
24 ret = str;
25 });
27 test( "Concat String from charCode", function(){
28 var str = "";
29 for ( var i = 0; i < num / 2; i++ )
30 str += String.fromCharCode(97);
31 ret = str;
32 });
34 test( "Array String Join", function(){
35 var str = [];
36 for ( var i = 0; i < num / 2; i++ )
37 str.push("a");
38 ret = str.join("");
39 });
41 var ostr = [], tmp, tmp2, num = 5000, tmpstr;
43 for ( var i = 0; i < 16384; i++ )
44 ostr.push( String.fromCharCode( (25 * Math.random()) + 97 ) );
46 ostr = ostr.join("");
47 ostr += ostr;
48 ostr += ostr;
50 var str;
51 var i = 52288;
53 prep(function(){
54 str = new String(ostr);
55 });
57 // TESTS: split
58 test( "String Split", function(){
59 ret = str.split("");
60 });
62 prep(function(){
63 tmpstr = str;
64 tmpstr += tmpstr;
65 tmpstr += tmpstr;
66 tmpstr += tmpstr;
67 tmpstr += tmpstr;
68 });
70 test( "String Split on Char", function(){
71 ret = tmpstr.split("a");
72 });
74 prep(function(){
75 str += str;
76 });
78 // TESTS: characters
80 test( "charAt", function(){
81 for ( var j = 0; j < num; j++ ) {
82 ret = str.charAt(0);
83 ret = str.charAt(str.length - 1);
84 ret = str.charAt( 15000 );
85 ret = str.charAt( 12000 );
87 });
89 test( "[Number]", function(){
90 for ( var j = 0; j < num; j++ ) {
91 ret = str[0];
92 ret = str[str.length - 1];
93 ret = str[ 15000 ];
94 ret = str[ 10000 ];
95 ret = str[ 5000 ];
97 });
99 test( "charCodeAt", function(){
100 for ( var j = 0; j < num; j++ ) {
101 ret = str.charCodeAt(0);
102 ret = str.charCodeAt(str.length - 1);
103 ret = str.charCodeAt( 15000 );
104 ret = str.charCodeAt( 10000 );
105 ret = str.charCodeAt( 5000 );
109 // TESTS: indexOf
111 test( "indexOf", function(){
112 for ( var j = 0; j < num; j++ ) {
113 ret = str.indexOf("a");
114 ret = str.indexOf("b");
115 ret = str.indexOf("c");
116 ret = str.indexOf("d");
120 test( "lastIndexOf", function(){
121 for ( var j = 0; j < num; j++ ) {
122 ret = str.lastIndexOf("a");
123 ret = str.lastIndexOf("b");
124 ret = str.lastIndexOf("c");
125 ret = str.lastIndexOf("d");
129 // TESTS: slice
131 test( "slice", function(){
132 for ( var j = 0; j < num; j++ ) {
133 ret = str.slice(0);
134 ret = str.slice(0,5);
135 ret = str.slice(-1);
136 ret = str.slice(-6,-1);
137 ret = str.slice( 15000, 15005 );
138 ret = str.slice( 12000, -1 );
142 // TESTS: substr
144 test( "substr", function(){
145 for ( var j = 0; j < num; j++ ) {
146 ret = str.substr(0);
147 ret = str.substr(0,5);
148 ret = str.substr(-1);
149 ret = str.substr(-6,1);
150 ret = str.substr( 15000, 5 );
151 ret = str.substr( 12000, 5 );
155 // TESTS: substring
157 test( "substring", function(){
158 for ( var j = 0; j < num; j++ ) {
159 ret = str.substring(0);
160 ret = str.substring(0,5);
161 ret = str.substring(-1);
162 ret = str.substring(-6,-1);
163 ret = str.substring( 15000, 15005 );
164 ret = str.substring( 12000, -1 );
168 // TESTS: toLower/UpperCase
170 test( "toLowerCase", function(){
171 for ( var j = 0; j < num / 1000; j++ ) {
172 ret = str.toLowerCase();
176 test( "toUpperCase", function(){
177 for ( var j = 0; j < num / 1000; j++ ) {
178 ret = str.toUpperCase();
182 // TESTS: comparing
183 prep(function(){
184 tmp = str;
185 tmp2 = str;
188 test( "comparing", function(){
189 tmp = "a" + tmp + "a";
190 tmp2 = "a" + tmp2 + "a";
191 for ( var j = 0; j < num / 1000; j++ ) {
192 ret = tmp == tmp2;
193 ret = tmp < tmp2;
194 ret = tmp > tmp2;
198 endTest(); };
199 </script>
200 </head>
201 <body></body>
202 </html>