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

Side by Side Diff: third_party/WebKit/LayoutTests/resize-observer/observe.html

Issue 2303893003: Pass ResizeObserver as 'this' to callback (Closed)
Patch Set: CR fix, merge master Created 4 years, 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/bindings.gni » ('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 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="./resources/resizeTestHelper.js"></script> 4 <script src="./resources/resizeTestHelper.js"></script>
5 <p>ResizeObserver tests</p> 5 <p>ResizeObserver tests</p>
6 <div id="target1" style="width:100px;height:100px;">t1</div> 6 <div id="target1" style="width:100px;height:100px;">t1</div>
7 <div id="target2" style="width:100px;height:100px;">t2</div> 7 <div id="target2" style="width:100px;height:100px;">t2</div>
8 <img id="target3" style="width:100px;height:100px;"> 8 <img id="target3" style="width:100px;height:100px;">
9 <iframe src="./resources/iframe.html" width="300px" height="100px" style="displa y:block"></iframe> 9 <iframe src="./resources/iframe.html" width="300px" height="100px" style="displa y:block"></iframe>
10 <script> 10 <script>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 test.done(); 157 test.done();
158 resolvePromise(); 158 resolvePromise();
159 }); 159 });
160 }); 160 });
161 break; 161 break;
162 } 162 }
163 }, false); 163 }, false);
164 return promise; 164 return promise;
165 } 165 }
166 166
167 function test7() {
168 let harnessTest = async_test("test7: callback.this");
169 let resolvePromise;
170 let ro = new ResizeObserver( function(entries, obs) {
171 let callbackThis = this;
172 resolvePromise();
173 harnessTest.step(() => {
174 assert_equals(callbackThis, ro, "callback.this is ResizeObserver");
175 assert_equals(obs, ro, "2nd argument is ResizeObserver");
176 ro.disconnect();
177 // every reference to RO must be null before test completes
178 // to avoid triggering test leak-detection
179 ro = null;
180 callbackThis = null;
181 obs = null;
182 harnessTest.done();
183 });
184 }
185 );
186 ro.observe(t1);
187
188 return new Promise( (resolve, reject) => {
189 resolvePromise = resolve;
190 });
191 }
167 let guard = async_test('guard'); 192 let guard = async_test('guard');
168 test0() 193 test0()
169 .then(() => { return test1(); }) 194 .then(() => { return test1(); })
170 .then(() => { return test2(); }) 195 .then(() => { return test2(); })
171 .then(() => { return test3(); }) 196 .then(() => { return test3(); })
172 .then(() => { return test4(); }) 197 .then(() => { return test4(); })
173 .then(() => { return test5(); }) 198 .then(() => { return test5(); })
174 .then(() => { return test6(); }) 199 .then(() => { return test6(); })
200 .then(() => { return test7(); })
175 .then(() => { guard.done(); }); 201 .then(() => { guard.done(); });
176 202
177 </script> 203 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/bindings.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698