Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: ppapi/tests/test_case.html

Issue 264303002: PPAPI: Implement synchronous postMessage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppp_messaging_proxy.cc ('k') | ppapi/tests/test_message_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_case.html
diff --git a/ppapi/tests/test_case.html b/ppapi/tests/test_case.html
index 987c10284c86306f14481cbd8a89c261aef0d213..f0992ec44147f17c456e57173760c40cc0be04b9 100644
--- a/ppapi/tests/test_case.html
+++ b/ppapi/tests/test_case.html
@@ -3,6 +3,42 @@
<meta http-equiv="Expires" content="-1" />
<link rel="stylesheet" href="test_page.css">
<script>
+// Do a deep comparison of two values. Return true if their values are
+// identical, false otherwise.
+function deepCompare(left, right) {
+ if (typeof(left) !== typeof(right))
+ return false;
+ // If their identity is the same or they're basic types with the same value,
+ // they are equal.
+ if (left === right)
+ return true;
+ // If it's a basic type and we got here, we know they're not equal.
+ if (["undefined", "boolean", "number", "string", "function"].indexOf(
+ typeof(left)) > -1) {
+ return false;
+ }
+ // Use right_keys as a set containing all keys from |right| which we haven't
+ // yet compared.
+ var right_keys = {};
+ for (var key in right)
+ right_keys[key] = true;
+ for (var key in left) {
+ if (key in right_keys) {
+ if (!deepCompare(left[key], right[key]))
+ return false;
+ } else {
+ // |left| had a key that |right| didn't.
+ return false;
+ }
+ delete right_keys[key];
+ }
+ // If there are keys left in |right_keys|, it means they didn't exist in
+ // |left|, so the objects aren't equal.
+ if (Object.keys(right_keys).length > 0)
+ return false;
+ return true;
+}
+
function AdjustHeight(frameWin) {
var div = frameWin.document.getElementsByTagName("div")[0];
var height = frameWin.getComputedStyle(div).height;
« no previous file with comments | « ppapi/proxy/ppp_messaging_proxy.cc ('k') | ppapi/tests/test_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698