OLD | NEW |
1 <html><head> | 1 <html><head> |
2 <meta http-equiv="Pragma" content="no-cache" /> | 2 <meta http-equiv="Pragma" content="no-cache" /> |
3 <meta http-equiv="Expires" content="-1" /> | 3 <meta http-equiv="Expires" content="-1" /> |
4 <link rel="stylesheet" href="test_page.css"> | 4 <link rel="stylesheet" href="test_page.css"> |
5 <script> | 5 <script> |
| 6 // Do a deep comparison of two values. Return true if their values are |
| 7 // identical, false otherwise. |
| 8 function deepCompare(left, right) { |
| 9 if (typeof(left) !== typeof(right)) |
| 10 return false; |
| 11 // If their identity is the same or they're basic types with the same value, |
| 12 // they are equal. |
| 13 if (left === right) |
| 14 return true; |
| 15 // If it's a basic type and we got here, we know they're not equal. |
| 16 if (["undefined", "boolean", "number", "string", "function"].indexOf( |
| 17 typeof(left)) > -1) { |
| 18 return false; |
| 19 } |
| 20 // Use right_keys as a set containing all keys from |right| which we haven't |
| 21 // yet compared. |
| 22 var right_keys = {}; |
| 23 for (var key in right) |
| 24 right_keys[key] = true; |
| 25 for (var key in left) { |
| 26 if (key in right_keys) { |
| 27 if (!deepCompare(left[key], right[key])) |
| 28 return false; |
| 29 } else { |
| 30 // |left| had a key that |right| didn't. |
| 31 return false; |
| 32 } |
| 33 delete right_keys[key]; |
| 34 } |
| 35 // If there are keys left in |right_keys|, it means they didn't exist in |
| 36 // |left|, so the objects aren't equal. |
| 37 if (Object.keys(right_keys).length > 0) |
| 38 return false; |
| 39 return true; |
| 40 } |
| 41 |
6 function AdjustHeight(frameWin) { | 42 function AdjustHeight(frameWin) { |
7 var div = frameWin.document.getElementsByTagName("div")[0]; | 43 var div = frameWin.document.getElementsByTagName("div")[0]; |
8 var height = frameWin.getComputedStyle(div).height; | 44 var height = frameWin.getComputedStyle(div).height; |
9 frameWin.frameElement.style.height = height; | 45 frameWin.frameElement.style.height = height; |
10 } | 46 } |
11 | 47 |
12 // Called when the tests are completed. |result| should be "PASS" if the test(s) | 48 // Called when the tests are completed. |result| should be "PASS" if the test(s) |
13 // passed, or information about the failure if the test(s) did not pass. | 49 // passed, or information about the failure if the test(s) did not pass. |
14 function DidExecuteTests(result) { | 50 function DidExecuteTests(result) { |
15 var plugin = document.getElementById("plugin"); | 51 var plugin = document.getElementById("plugin"); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 InternalError("Bad MessageEvent.initMessageEvent called!"); | 361 InternalError("Bad MessageEvent.initMessageEvent called!"); |
326 } | 362 } |
327 | 363 |
328 </script> | 364 </script> |
329 </head><body> | 365 </head><body> |
330 <div> | 366 <div> |
331 <div id="container"></div> | 367 <div id="container"></div> |
332 <div id="console"><span class="load_msg">loading...</span></div> | 368 <div id="console"><span class="load_msg">loading...</span></div> |
333 </div> | 369 </div> |
334 </body></html> | 370 </body></html> |
OLD | NEW |