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

Side by Side Diff: chrome/test/chromedriver/js/call_function_test.html

Issue 11884058: [chromedriver] Implement commands: findChildElement, findChildElements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/chromedriver/js/call_function.js ('k') | chrome/test/chromedriver/run_py_tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <script src='test.js'></script> 3 <script src='test.js'></script>
4 <script src='call_function.js'></script> 4 <script src='call_function.js'></script>
5 <script> 5 <script>
6 6
7 function testCallFunctionNoArgs() { 7 function testCallFunctionNoArgs() {
8 var result = callFunction(function() { return 1; }, []); 8 var result = callFunction(function() { return 1; }, []);
9 assertEquals(0, result.status); 9 assertEquals(0, result.status);
10 assertEquals(1, result.value); 10 assertEquals(1, result.value);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 assertEquals(null, cache.wrap(null)); 56 assertEquals(null, cache.wrap(null));
57 assertEquals(null, cache.unwrap(null)); 57 assertEquals(null, cache.unwrap(null));
58 assertEquals(undefined, cache.wrap(undefined)); 58 assertEquals(undefined, cache.wrap(undefined));
59 assertEquals(undefined, cache.unwrap(undefined)); 59 assertEquals(undefined, cache.unwrap(undefined));
60 function func() {} 60 function func() {}
61 assertEquals(func, cache.wrap(func)); 61 assertEquals(func, cache.wrap(func));
62 assertEquals(func, cache.unwrap(func)); 62 assertEquals(func, cache.unwrap(func));
63 63
64 var arr = [1, new Array(1, new Object({a: 1, b: {a: 1, b: {}, c: 3}}), 3)]; 64 var arr = [1, new Array(1, new Object({a: 1, b: {a: 1, b: {}, c: 3}}), 3)];
65 var originalJson = JSON.stringify(arr); 65 var originalJson = JSON.stringify(arr);
66 arr[1][1].b.b[ELEMENT_KEY] = cache.nextId_; 66 arr[1][1].b.b[ELEMENT_KEY] = cache.nextId_.toString();
67 var wrappedJson = JSON.stringify(arr); 67 var wrappedJson = JSON.stringify(arr);
68 arr[1][1].b.b = document; 68 arr[1][1].b.b = document;
69 assertEquals(wrappedJson, JSON.stringify(cache.wrap(arr))); 69 assertEquals(wrappedJson, JSON.stringify(cache.wrap(arr)));
70 var unwrapped = cache.unwrap(JSON.parse(wrappedJson)); 70 var unwrapped = cache.unwrap(JSON.parse(wrappedJson));
71 assertEquals(document, unwrapped[1][1].b.b); 71 assertEquals(document, unwrapped[1][1].b.b);
72 unwrapped[1][1].b.b = {}; 72 unwrapped[1][1].b.b = {};
73 assertEquals(originalJson, JSON.stringify(unwrapped)); 73 assertEquals(originalJson, JSON.stringify(unwrapped));
74 } 74 }
75 75
76 function testCacheDoubleWrap() { 76 function testCacheDoubleWrap() {
77 var cache = new Cache(); 77 var cache = new Cache();
78 assertEquals(cache.wrap(document)[ELEMENT_KEY], 78 assertEquals(cache.wrap(document)[ELEMENT_KEY],
79 cache.wrap(document)[ELEMENT_KEY]); 79 cache.wrap(document)[ELEMENT_KEY]);
80 } 80 }
81 81
82 function testCacheUnwrapThrows() { 82 function testCacheUnwrapThrows() {
83 try { 83 try {
84 var cache = new Cache(); 84 var cache = new Cache();
85 var wrapped = {}; 85 var wrapped = {};
86 wrapped[ELEMENT_KEY] = 1; 86 wrapped[ELEMENT_KEY] = '1';
87 cache.unwrap(wrapped); 87 cache.unwrap(wrapped);
88 } catch (e) { 88 } catch (e) {
89 return; 89 return;
90 } 90 }
91 assert(false); 91 assert(false);
92 } 92 }
93 93
94 function testClearStale() { 94 function testClearStale() {
95 var doc = document; 95 var doc = document;
96 var div = doc.querySelector('div'); 96 var div = doc.querySelector('div');
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return; 140 return;
141 } 141 }
142 assert(false); 142 assert(false);
143 } 143 }
144 144
145 </script> 145 </script>
146 <body> 146 <body>
147 <div><span></span></div> 147 <div><span></span></div>
148 </body> 148 </body>
149 </html> 149 </html>
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/js/call_function.js ('k') | chrome/test/chromedriver/run_py_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698