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

Side by Side Diff: chrome/test/data/layout_tests/layout_test_controller.html

Issue 8480035: Mock implementation of overridePreference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <script> 1 <script>
2 function LayoutTestController() { 2 function LayoutTestController() {
3 this.dump_as_text_ = false; 3 this.dump_as_text_ = false;
4 this.wait_until_done_ = false; 4 this.wait_until_done_ = false;
5 5
6 this.dumpAsText = function () { 6 this.dumpAsText = function () {
7 this.dump_as_text_ = true; 7 this.dump_as_text_ = true;
8 }; 8 };
9 9
10 this.waitUntilDone = function () { 10 this.waitUntilDone = function () {
11 this.wait_until_done_ = true; 11 this.wait_until_done_ = true;
12 }; 12 };
13 13
14 this.notifyDone = function () { 14 this.notifyDone = function () {
15 // For storage events, it actually takes 2 rounds of yielding for everything 15 // For storage events, it actually takes 2 rounds of yielding for everything
16 // to complete. 16 // to complete.
17 setTimeout(layoutTestController.DelayedNotifyDone1, 0); 17 setTimeout(layoutTestController.DelayedNotifyDone1, 0);
18 }; 18 };
19 19
20 this.overridePreference = function () {
21 // WebSocket tests call this function by preference name
22 // 'WebKitHixie76WebSocketProtocolEnabled' to switch its protocol version.
23 // In Chromium, the value must be 0 because it doesn't support old one.
24 };
25
20 this.DelayedNotifyDone1 = function () { 26 this.DelayedNotifyDone1 = function () {
21 setTimeout(layoutTestController.DelayedNotifyDone2, 0); 27 setTimeout(layoutTestController.DelayedNotifyDone2, 0);
22 }; 28 };
23 29
24 this.DelayedNotifyDone2 = function () { 30 this.DelayedNotifyDone2 = function () {
25 var token = encodeURIComponent(document.body.innerText); 31 var token = encodeURIComponent(document.body.innerText);
26 document.cookie = "%COOKIE%=" + token; 32 document.cookie = "%COOKIE%=" + token;
27 }; 33 };
28 34
29 this.OnEvent = function () { 35 this.OnEvent = function () {
30 // HACK: dumpAsText() is always called after waitUntilDone() and all tests 36 // HACK: dumpAsText() is always called after waitUntilDone() and all tests
31 // that are run within the UI test framework either call 37 // that are run within the UI test framework either call
32 // waitUntilDone() or dumpAsText(). So we'll simply keep polling 38 // waitUntilDone() or dumpAsText(). So we'll simply keep polling
33 // until we see one or the other. 39 // until we see one or the other.
34 if (layoutTestController.dump_as_text_) { 40 if (layoutTestController.dump_as_text_) {
35 if (!layoutTestController.wait_until_done_) 41 if (!layoutTestController.wait_until_done_)
36 layoutTestController.notifyDone(); 42 layoutTestController.notifyDone();
37 } else { 43 } else {
38 setTimeout(layoutTestController.OnEvent, 200); 44 setTimeout(layoutTestController.OnEvent, 200);
39 } 45 }
40 }; 46 };
41 } 47 }
42 48
43 window.layoutTestController = new LayoutTestController(); 49 window.layoutTestController = new LayoutTestController();
44 window.addEventListener('load', layoutTestController.OnEvent, false); 50 window.addEventListener('load', layoutTestController.OnEvent, false);
45 </script> 51 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698