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

Side by Side Diff: LayoutTests/fast/forms/page-popup/page-popup-adjust-rect.html

Issue 243173004: Make window.screen property non replaceable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Do not add a new Internals API Created 6 years, 8 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script src="../../forms/resources/common.js"></script> 5 <script src="../../forms/resources/common.js"></script>
6 <script src="../../forms/resources/picker-common.js"></script> 6 <script src="../../forms/resources/picker-common.js"></script>
7 <script src="../calendar-picker/resources/calendar-picker-common.js"></script> 7 <script src="../calendar-picker/resources/calendar-picker-common.js"></script>
8 </head> 8 </head>
9 <body> 9 <body>
10 <p id="description"></p> 10 <p id="description"></p>
11 <div id="console"></div> 11 <div id="console"></div>
12 12
13 <input type="date" id="date"> 13 <input type="date" id="date">
14 14
15 <script> 15 <script>
16 description('Test for child elements of a datalist element.'); 16 description('Test for child elements of a datalist element.');
17 17
18 openPicker(document.getElementById('date'), test); 18 openPicker(document.getElementById('date'), test);
19 19
20 function makeRect(x, y, width, height) { 20 function makeRect(x, y, width, height) {
21 return { 21 return {
22 x: x, 22 x: x,
23 y: y, 23 y: y,
24 width: width, 24 width: width,
25 height: height 25 height: height
26 }; 26 };
27 } 27 }
28 28
29 function overridePopupWindowScreenObject(w) {
arv (Not doing code reviews) 2014/04/21 19:23:43 You should also be able to do: Object.definePrope
Inactive 2014/04/21 19:51:53 This did not seem to work so I used your other pro
30 delete w.screen['width']
arv (Not doing code reviews) 2014/04/21 19:18:16 delete w.screen.width;
31 w.screen.width = 80;
32 delete w.screen['height']
33 w.screen.height = 60;
34 delete w.screen['availLeft']
35 w.screen.availLeft = 0;
36 delete w.screen['availTop']
37 w.screen.availTop = 0;
38 delete w.screen['availWidth']
39 w.screen.availWidth = 80;
40 delete w.screen['availHeight']
41 w.screen.availHeight = 60;
42 }
43
29 function test() { 44 function test() {
30 popupWindow.screen = { 45 overridePopupWindowScreenObject(popupWindow);
31 width: 80,
32 height: 60,
33 availLeft: 0,
34 availTop: 0,
35 availWidth: 80,
36 availHeight: 60,
37 };
38 46
39 debug("Move anchor element along the vertical axis."); 47 debug("Move anchor element along the vertical axis.");
40 48
41 popupWindow.global.params.anchorRectInScreen = makeRect(0, -20, 20, 10); 49 popupWindow.global.params.anchorRectInScreen = makeRect(0, -20, 20, 10);
42 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString ()', 'Rectangle(0,0,30,10)'); 50 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString ()', 'Rectangle(0,0,30,10)');
43 51
44 popupWindow.global.params.anchorRectInScreen = makeRect(0, -10, 20, 10); 52 popupWindow.global.params.anchorRectInScreen = makeRect(0, -10, 20, 10);
45 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString ()', 'Rectangle(0,0,30,10)'); 53 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString ()', 'Rectangle(0,0,30,10)');
46 54
47 popupWindow.global.params.anchorRectInScreen = makeRect(0, 0, 20, 10); 55 popupWindow.global.params.anchorRectInScreen = makeRect(0, 0, 20, 10);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 218
211 popupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 30, 10); 219 popupWindow.global.params.anchorRectInScreen = makeRect(30, 0, 30, 10);
212 shouldBeEqualToString('popupWindow.adjustWindowRect(90, 10, 90, 10).toString ()', 'Rectangle(0,10,90,10)'); 220 shouldBeEqualToString('popupWindow.adjustWindowRect(90, 10, 90, 10).toString ()', 'Rectangle(0,10,90,10)');
213 221
214 finishJSTest(); 222 finishJSTest();
215 } 223 }
216 224
217 </script> 225 </script>
218 </body> 226 </body>
219 </html> 227 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698