Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var layoutTestController = layoutTestController || {}; | 5 var layoutTestController = layoutTestController || {}; |
| 6 var testRunner = testRunner || {}; | 6 var testRunner = testRunner || {}; |
| 7 var accessibilityController = accessibilityController || {}; | |
| 8 var gamepadController = gamepadController || {}; | |
| 9 var eventSender = eventSender || {}; | |
| 10 var textInputController = textInputController || {}; | |
| 7 | 11 |
| 8 (function() { | 12 (function() { |
| 9 native function NotifyDone(); | 13 native function NotifyDone(); |
| 10 native function SetDumpAsText(); | 14 native function SetDumpAsText(); |
| 11 native function SetDumpChildFramesAsText(); | 15 native function SetDumpChildFramesAsText(); |
| 12 native function SetPrinting(); | 16 native function SetPrinting(); |
| 13 native function SetShouldStayOnPageAfterHandlingBeforeUnload(); | 17 native function SetShouldStayOnPageAfterHandlingBeforeUnload(); |
| 14 native function SetWaitUntilDone(); | 18 native function SetWaitUntilDone(); |
| 15 | 19 |
| 16 layoutTestController = new function() { | 20 native function NotImplemented(); |
| 17 this.notifyDone = NotifyDone; | |
| 18 this.dumpAsText = SetDumpAsText; | |
| 19 this.dumpChildFramesAsText = SetDumpChildFramesAsText; | |
| 20 this.setPrinting = SetPrinting; | |
| 21 this.setShouldStayOnPageAfterHandlingBeforeUnload = | |
| 22 SetShouldStayOnPageAfterHandlingBeforeUnload; | |
| 23 this.waitUntilDone = SetWaitUntilDone; | |
| 24 }(); | |
| 25 | 21 |
| 26 testRunner = layoutTestController; | 22 var DefaultHandler = function(name) { |
| 23 var handler = { | |
| 24 get: function(receiver, property) { | |
| 25 return function() { | |
| 26 return NotImplemented(name, property); | |
| 27 } | |
| 28 } | |
| 29 } | |
| 30 return Proxy.create(handler); | |
| 31 } | |
| 27 | 32 |
| 33 var defineProperty = function(obj, name, callback) { | |
| 34 Object.defineProperty(obj, name, { get: function() { return callback; }, | |
|
rossberg
2012/07/09 15:54:29
Tip: {value: callback} should be good enough her
jochen (gone - plz use gerrit)
2012/07/09 19:25:52
Done.
| |
| 35 configurable: false }); | |
| 36 } | |
| 37 | |
| 38 var LayoutTestController = function() { | |
| 39 defineProperty(this, "notifyDone", NotifyDone); | |
| 40 defineProperty(this, "dumpAsText", SetDumpAsText); | |
| 41 defineProperty(this, | |
| 42 "dumpChildFramesAsText", | |
| 43 SetDumpChildFramesAsText); | |
| 44 defineProperty(this, "setPrinting", SetPrinting); | |
| 45 defineProperty(this, | |
| 46 "setShouldStayOnPageAfterHandlingBeforeUnload", | |
| 47 SetShouldStayOnPageAfterHandlingBeforeUnload); | |
| 48 defineProperty(this, "waitUntilDone", SetWaitUntilDone); | |
| 49 } | |
| 50 LayoutTestController.prototype = DefaultHandler("layoutTestController"); | |
| 51 layoutTestController = new LayoutTestController(); | |
| 52 testRunner = new LayoutTestController(); | |
| 53 | |
| 54 var AccessibilityController = function() {} | |
| 55 AccessibilityController.prototype = DefaultHandler("accessibilityController"); | |
| 56 accessibilityController = new AccessibilityController(); | |
| 57 | |
| 58 var GamepadController = function() {} | |
| 59 GamepadController.prototype = DefaultHandler("gamepadController"); | |
| 60 gamepadController = new GamepadController(); | |
| 61 | |
| 62 var EventSender = function() {} | |
| 63 EventSender.prototype = DefaultHandler("eventSender"); | |
| 64 eventSender = new EventSender(); | |
| 65 | |
| 66 var TextInputController = function() {} | |
| 67 TextInputController.prototype = DefaultHandler("textInputController"); | |
| 68 textInputController = new TextInputController(); | |
| 28 })(); | 69 })(); |
| OLD | NEW |